Skip to content

Commit

Permalink
Mark bcm_redirector functions as local (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail authored Dec 11, 2023
1 parent c7c418a commit c4e7f93
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion util/fipstools/delocate/delocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2294,7 +2294,7 @@ func isFipsScopeMarkers(symbol string) bool {
}

func redirectorName(symbol string) string {
return "bcm_redirector_" + symbol
return ".Lbcm_redirector_" + symbol
}

// sectionType returns the type of a section. I.e. a section called “.text.foo”
Expand Down
30 changes: 15 additions & 15 deletions util/fipstools/delocate/testdata/aarch64-Basic/out.s
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ foo:
bl .Llocal_function_local_target

// WAS bl remote_function
bl bcm_redirector_remote_function
bl .Lbcm_redirector_remote_function

bl bss_symbol_bss_get

Expand All @@ -123,9 +123,9 @@ foo:
// But 'y' is not a register prefix so far, so these should be
// processed as symbols.
// WAS add y0, y0
add bcm_redirector_y0, bcm_redirector_y0
add .Lbcm_redirector_y0, .Lbcm_redirector_y0
// WAS add y12, y12
add bcm_redirector_y12, bcm_redirector_y12
add .Lbcm_redirector_y12, .Lbcm_redirector_y12

// Make sure that the magic extension constants are recognised rather
// than being interpreted as symbols.
Expand Down Expand Up @@ -176,29 +176,29 @@ bss_symbol:
.type BORINGSSL_bcm_text_end, @function
BORINGSSL_bcm_text_end:
.p2align 2
.hidden bcm_redirector_remote_function
.type bcm_redirector_remote_function, @function
bcm_redirector_remote_function:
.hidden .Lbcm_redirector_remote_function
.type .Lbcm_redirector_remote_function, @function
.Lbcm_redirector_remote_function:
.cfi_startproc
b remote_function
.cfi_endproc
.size bcm_redirector_remote_function, .-bcm_redirector_remote_function
.size .Lbcm_redirector_remote_function, .-.Lbcm_redirector_remote_function
.p2align 2
.hidden bcm_redirector_y0
.type bcm_redirector_y0, @function
bcm_redirector_y0:
.hidden .Lbcm_redirector_y0
.type .Lbcm_redirector_y0, @function
.Lbcm_redirector_y0:
.cfi_startproc
b y0
.cfi_endproc
.size bcm_redirector_y0, .-bcm_redirector_y0
.size .Lbcm_redirector_y0, .-.Lbcm_redirector_y0
.p2align 2
.hidden bcm_redirector_y12
.type bcm_redirector_y12, @function
bcm_redirector_y12:
.hidden .Lbcm_redirector_y12
.type .Lbcm_redirector_y12, @function
.Lbcm_redirector_y12:
.cfi_startproc
b y12
.cfi_endproc
.size bcm_redirector_y12, .-bcm_redirector_y12
.size .Lbcm_redirector_y12, .-.Lbcm_redirector_y12
.p2align 2
.hidden bss_symbol_bss_get
.type bss_symbol_bss_get, @function
Expand Down
16 changes: 8 additions & 8 deletions util/fipstools/delocate/testdata/ppc64le-Sample/out.s
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function:
ld 3, -16(1)
addi 1, 1, 288
# WAS bl fprintf
bl bcm_redirector_fprintf
bl .Lbcm_redirector_fprintf
ld 2, 24(1)
nop
# WAS addis 10,2,.LC0@toc@ha
Expand Down Expand Up @@ -182,7 +182,7 @@ function:
addi 1, 1, 288
ld 5, 0(5)
# WAS bl fprintf
bl bcm_redirector_fprintf
bl .Lbcm_redirector_fprintf
ld 2, 24(1)
nop
# WAS addis 10,2,.LC0@toc@ha
Expand Down Expand Up @@ -228,7 +228,7 @@ function:
ld 3, -16(1)
addi 1, 1, 288
# WAS bl fprintf
bl bcm_redirector_fprintf
bl .Lbcm_redirector_fprintf
ld 2, 24(1)
nop
# WAS addis 10,2,.LC0@toc@ha
Expand Down Expand Up @@ -275,7 +275,7 @@ function:
addi 1, 1, 288
ld 5, 0(5)
# WAS bl fprintf
bl bcm_redirector_fprintf
bl .Lbcm_redirector_fprintf
ld 2, 24(1)
nop
# WAS addis 10,2,.LC0@toc@ha
Expand Down Expand Up @@ -322,7 +322,7 @@ function:
addi 1, 1, 288
ld 5, 0(5)
# WAS bl fprintf
bl bcm_redirector_fprintf
bl .Lbcm_redirector_fprintf
ld 2, 24(1)
nop
# WAS addis 10,2,.LC0@toc@ha
Expand Down Expand Up @@ -369,7 +369,7 @@ function:
addi 1, 1, 288
ld 5, 0(5)
# WAS bl fprintf
bl bcm_redirector_fprintf
bl .Lbcm_redirector_fprintf
ld 2, 24(1)
nop
# WAS bl exported_function
Expand Down Expand Up @@ -423,8 +423,8 @@ BORINGSSL_bcm_text_end:
.Lredirector_toc_fprintf:
.quad fprintf
.text
.type bcm_redirector_fprintf, @function
bcm_redirector_fprintf:
.type .Lbcm_redirector_fprintf, @function
.Lbcm_redirector_fprintf:
std 2, 24(1)
addis 12, 2, .Lredirector_toc_fprintf@toc@ha
ld 12, .Lredirector_toc_fprintf@toc@l(12)
Expand Down
28 changes: 14 additions & 14 deletions util/fipstools/delocate/testdata/ppc64le-Sample2/out.s
Original file line number Diff line number Diff line change
Expand Up @@ -207,47 +207,47 @@ exported_function:
mr 6,29
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
mr 5,22
mr 6,19
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
mr 5,23
mr 6,24
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
mr 5,25
mr 6,20
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
mr 5,26
mr 6,27
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
li 4,1
mr 5,28
mr 6,30
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
b .L2
Expand Down Expand Up @@ -323,7 +323,7 @@ function:
stdu 1,-112(1)
ld 3,0(31)
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
# WAS addis 6,2,.LC12@toc@ha # gpr load fusion, type long
Expand Down Expand Up @@ -356,7 +356,7 @@ function:
ld 3, -16(1)
addi 1, 1, 288
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
Expand Down Expand Up @@ -388,7 +388,7 @@ function:
addi 1, 1, 288
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
# WAS addis 6,2,.LC13@toc@ha # gpr load fusion, type long
Expand Down Expand Up @@ -421,7 +421,7 @@ function:
ld 3, -16(1)
addi 1, 1, 288
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
Expand All @@ -441,7 +441,7 @@ function:
addi 1, 1, 288
li 4,1
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
ld 3,0(31)
Expand All @@ -462,7 +462,7 @@ function:
addi 1, 1, 288
addi 6,6,-29404
# WAS bl __fprintf_chk
bl bcm_redirector___fprintf_chk
bl .Lbcm_redirector___fprintf_chk
ld 2, 24(1)
nop
# WAS bl exported_function
Expand Down Expand Up @@ -542,8 +542,8 @@ BORINGSSL_bcm_text_end:
.Lredirector_toc___fprintf_chk:
.quad __fprintf_chk
.text
.type bcm_redirector___fprintf_chk, @function
bcm_redirector___fprintf_chk:
.type .Lbcm_redirector___fprintf_chk, @function
.Lbcm_redirector___fprintf_chk:
std 2, 24(1)
addis 12, 2, .Lredirector_toc___fprintf_chk@toc@ha
ld 12, .Lredirector_toc___fprintf_chk@toc@l(12)
Expand Down
10 changes: 5 additions & 5 deletions util/fipstools/delocate/testdata/x86_64-LabelRewrite/out.s
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ bar:

# Jumps to PLT symbols are rewritten through redirectors.
# WAS call memcpy@PLT
call bcm_redirector_memcpy
call .Lbcm_redirector_memcpy
# WAS jmp memcpy@PLT
jmp bcm_redirector_memcpy
jmp .Lbcm_redirector_memcpy
# WAS jbe memcpy@PLT
jbe bcm_redirector_memcpy
jbe .Lbcm_redirector_memcpy

# Jumps to local PLT symbols use their local targets.
# WAS call foo@PLT
Expand Down Expand Up @@ -98,8 +98,8 @@ bar:
.text
.loc 1 2 0
BORINGSSL_bcm_text_end:
.type bcm_redirector_memcpy, @function
bcm_redirector_memcpy:
.type .Lbcm_redirector_memcpy, @function
.Lbcm_redirector_memcpy:
jmp memcpy@PLT
.type OPENSSL_ia32cap_get, @function
.globl OPENSSL_ia32cap_get
Expand Down

0 comments on commit c4e7f93

Please sign in to comment.