diff options
Diffstat (limited to 'ld')
26 files changed, 345 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 66a5049..b5c8326 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,4 +1,35 @@ -2020-02-07 H.J. Lu <hongjiu.lu@intel.com> +2020-02-06 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/24526 + PR ld/25021 + PR ld/25490 + * testsuite/ld-elf/elf.exp: Run PR ld/25490 tests. + * testsuite/ld-elf/pr24526.d: New file. + * testsuite/ld-elf/pr24526.s: Likewise. + * testsuite/ld-elf/pr25021.d: Likewise. + * testsuite/ld-elf/pr25021.s: Likewise. + * testsuite/ld-elf/pr25490-2-16.rd: Likewise. + * testsuite/ld-elf/pr25490-2-32.rd: Likewise. + * testsuite/ld-elf/pr25490-2-64.rd: Likewise. + * testsuite/ld-elf/pr25490-2.s: Likewise. + * testsuite/ld-elf/pr25490-3-16.rd: Likewise. + * testsuite/ld-elf/pr25490-3-32.rd: Likewise. + * testsuite/ld-elf/pr25490-3-64.rd: Likewise. + * testsuite/ld-elf/pr25490-3.s: Likewise. + * testsuite/ld-elf/pr25490-4-16.rd: Likewise. + * testsuite/ld-elf/pr25490-4-32.rd: Likewise. + * testsuite/ld-elf/pr25490-4-64.rd: Likewise. + * testsuite/ld-elf/pr25490-4.s: Likewise. + * testsuite/ld-elf/pr25490-5-16.rd: Likewise. + * testsuite/ld-elf/pr25490-5-32.rd: Likewise. + * testsuite/ld-elf/pr25490-5-64.rd: Likewise. + * testsuite/ld-elf/pr25490-5.s: Likewise. + * testsuite/ld-elf/pr25490-6-16.rd: Likewise. + * testsuite/ld-elf/pr25490-6-32.rd: Likewise. + * testsuite/ld-elf/pr25490-6-64.rd: Likewise. + * testsuite/ld-elf/pr25490-6.s: Likewise. + +2020-02-06 H.J. Lu <hongjiu.lu@intel.com> * testsuite/lib/ld-lib.exp (check_gc_sections_available): Mark z80 as not supported. diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 989fb50..7b8e8f6 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -76,9 +76,32 @@ run_ld_link_tests [list \ if [is_elf64 tmpdir/symbol3w.a] { set ASFLAGS "$ASFLAGS --defsym ALIGN=3" set pr23900_1_exp "pr23900-1-64.rd" + set pr25490_2_exp "pr25490-2-64.rd" + set pr25490_3_exp "pr25490-3-64.rd" + set pr25490_4_exp "pr25490-4-64.rd" + set pr25490_5_exp "pr25490-5-64.rd" + set pr25490_6_exp "pr25490-6-64.rd" } else { set ASFLAGS "$ASFLAGS --defsym ALIGN=2" set pr23900_1_exp "pr23900-1-32.rd" + if { [istarget avr-*-*] + || [istarget h8300-*-*] + || [istarget ip2k-*-*] + || [istarget m68hc11-*] + || [istarget "xc16x-*"] + || [istarget "z80-*-*"] } { + set pr25490_2_exp "pr25490-2-16.rd" + set pr25490_3_exp "pr25490-3-16.rd" + set pr25490_4_exp "pr25490-4-16.rd" + set pr25490_5_exp "pr25490-5-16.rd" + set pr25490_6_exp "pr25490-6-16.rd" + } else { + set pr25490_2_exp "pr25490-2-32.rd" + set pr25490_3_exp "pr25490-3-32.rd" + set pr25490_4_exp "pr25490-4-32.rd" + set pr25490_5_exp "pr25490-5-32.rd" + set pr25490_6_exp "pr25490-6-32.rd" + } } @@ -172,6 +195,46 @@ if { [istarget *-*-*linux*] ] } +if [check_gc_sections_available] { + run_ld_link_tests [list \ + [list "__patchable_function_entries section 2" \ + "--gc-sections -e _start" \ + "" \ + "" \ + {pr25490-2.s} \ + [list [list "readelf" {-SW} $pr25490_2_exp]] \ + "pr25490-2.exe"] \ + [list "__patchable_function_entries section 3" \ + "--gc-sections -e _start" \ + "" \ + "" \ + {pr25490-3.s} \ + [list [list "readelf" {-SW} $pr25490_3_exp]] \ + "pr25490-3.exe"] \ + [list "__patchable_function_entries section 4" \ + "--gc-sections -e _start" \ + "" \ + "" \ + {pr25490-4.s} \ + [list [list "readelf" {-SW} $pr25490_4_exp]] \ + "pr25490-4.exe"] \ + [list "__patchable_function_entries section 5" \ + "--gc-sections -e _start" \ + "" \ + "" \ + {pr25490-5.s} \ + [list [list "readelf" {-SW} $pr25490_5_exp]] \ + "pr25490-5.exe"] \ + [list "__patchable_function_entries section 6" \ + "--gc-sections -e _start" \ + "" \ + "" \ + {pr25490-6.s} \ + [list [list "readelf" {-SW} $pr25490_6_exp]] \ + "pr25490-6.exe"] \ + ] +} + set LDFLAGS $old_ldflags set ASFLAGS $old_asflags diff --git a/ld/testsuite/ld-elf/pr24526.d b/ld/testsuite/ld-elf/pr24526.d new file mode 100644 index 0000000..3faaa1e --- /dev/null +++ b/ld/testsuite/ld-elf/pr24526.d @@ -0,0 +1,9 @@ +#ld: --gc-sections -e _start +#target: [check_gc_sections_available] +#readelf: -SW + +#... + +\[ *[0-9]+\] \.bar +PROGBITS +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +00 +AL .* +#... + +\[ *[0-9]+\] \.zed +PROGBITS +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +00 +AL .* +#pass diff --git a/ld/testsuite/ld-elf/pr24526.s b/ld/testsuite/ld-elf/pr24526.s new file mode 100644 index 0000000..7d77338 --- /dev/null +++ b/ld/testsuite/ld-elf/pr24526.s @@ -0,0 +1,13 @@ + .text + .globl _start +_start: + .byte 0 + .section .note,"",%note + .dc.a .foo + + .section .foo,"a" + .dc.a 0 + .section .bar,"ao",%progbits,.foo + .dc.a 0 + .section .zed,"ao",%progbits,.foo + .dc.a 0 diff --git a/ld/testsuite/ld-elf/pr25021.d b/ld/testsuite/ld-elf/pr25021.d new file mode 100644 index 0000000..1cb6a87 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25021.d @@ -0,0 +1,7 @@ +#ld: --gc-sections -e _start +#target: [check_gc_sections_available] +#readelf: -SW + +#... + +\[ *[0-9]+\] \.stack_sizes +PROGBITS +0+ +[0-9a-f]+ 0+1 +00 +L +[0-9] .* +#pass diff --git a/ld/testsuite/ld-elf/pr25021.s b/ld/testsuite/ld-elf/pr25021.s new file mode 100644 index 0000000..dd71202 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25021.s @@ -0,0 +1,22 @@ + .section .text.live,"ax",%progbits + .globl live +live: + .byte 0 + + .section .stack_sizes,"o",%progbits,.text.live,unique,0 + .byte 1 + + .section .text.dead,"ax",%progbits + .globl dead +dead: + .byte 1 + + .section .stack_sizes,"o",%progbits,.text.dead,unique,1 + .byte 2 + + .section .text.main,"ax",%progbits + .globl _start +_start: + .byte 0 + .section .note,"",%note + .dc.a live diff --git a/ld/testsuite/ld-elf/pr25490-2-16.rd b/ld/testsuite/ld-elf/pr25490-2-16.rd new file mode 100644 index 0000000..2e521cf --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-2-16.rd @@ -0,0 +1,7 @@ +#source: pr25490-2.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+2 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-2-32.rd b/ld/testsuite/ld-elf/pr25490-2-32.rd new file mode 100644 index 0000000..8b13348 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-2-32.rd @@ -0,0 +1,7 @@ +#source: pr25490-2.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+4 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-2-64.rd b/ld/testsuite/ld-elf/pr25490-2-64.rd new file mode 100644 index 0000000..6533042 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-2-64.rd @@ -0,0 +1,7 @@ +#source: pr25490-2.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+8 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-2.s b/ld/testsuite/ld-elf/pr25490-2.s new file mode 100644 index 0000000..856bb5f --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-2.s @@ -0,0 +1,9 @@ + .text + .globl _start + .type _start, %function +_start: + .section __patchable_function_entries,"awo",%progbits,_start + .dc.a .LPFE1 + .text +.LPFE1: + .byte 0 diff --git a/ld/testsuite/ld-elf/pr25490-3-16.rd b/ld/testsuite/ld-elf/pr25490-3-16.rd new file mode 100644 index 0000000..1c2f3d1 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-3-16.rd @@ -0,0 +1,7 @@ +#source: pr25490-3.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+2 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-3-32.rd b/ld/testsuite/ld-elf/pr25490-3-32.rd new file mode 100644 index 0000000..eb5587f --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-3-32.rd @@ -0,0 +1,7 @@ +#source: pr25490-3.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+4 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-3-64.rd b/ld/testsuite/ld-elf/pr25490-3-64.rd new file mode 100644 index 0000000..9fe794b --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-3-64.rd @@ -0,0 +1,7 @@ +#source: pr25490-3.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+8 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-3.s b/ld/testsuite/ld-elf/pr25490-3.s new file mode 100644 index 0000000..427ad69 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-3.s @@ -0,0 +1,18 @@ + .section .text.bar,"ax",%progbits + .globl bar + .type bar, %function +bar: + .section __patchable_function_entries,"awo",%progbits,bar + .dc.a .LPFE1 + .section .text.bar,"ax",%progbits +.LPFE1: + .byte 0 + .section .text._start,"ax",%progbits + .globl _start + .type _start, %function +_start: + .section __patchable_function_entries,"awo",%progbits,_start + .dc.a .LPFE2 + .section .text._start,"ax",%progbits +.LPFE2: + .byte 0 diff --git a/ld/testsuite/ld-elf/pr25490-4-16.rd b/ld/testsuite/ld-elf/pr25490-4-16.rd new file mode 100644 index 0000000..1f89d50 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-4-16.rd @@ -0,0 +1,7 @@ +#source: pr25490-4.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+4 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-4-32.rd b/ld/testsuite/ld-elf/pr25490-4-32.rd new file mode 100644 index 0000000..4562a6e --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-4-32.rd @@ -0,0 +1,7 @@ +#source: pr25490-4.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+8 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-4-64.rd b/ld/testsuite/ld-elf/pr25490-4-64.rd new file mode 100644 index 0000000..da295f3 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-4-64.rd @@ -0,0 +1,7 @@ +#source: pr25490-4.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-4.s b/ld/testsuite/ld-elf/pr25490-4.s new file mode 100644 index 0000000..5a31f8e --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-4.s @@ -0,0 +1,20 @@ + .section .text.bar,"ax",%progbits + .globl bar + .type bar, %function +bar: + .section __patchable_function_entries,"awo",%progbits,bar + .dc.a .LPFE1 + .section .text.bar,"ax",%progbits +.LPFE1: + .byte 0 + .section .text._start,"ax",%progbits + .globl _start + .type _start, %function +_start: + .section __patchable_function_entries,"awo",%progbits,_start + .dc.a .LPFE2 + .section .text._start,"ax",%progbits +.LPFE2: + .byte 0 + .section .note,"",%note + .dc.a bar diff --git a/ld/testsuite/ld-elf/pr25490-5-16.rd b/ld/testsuite/ld-elf/pr25490-5-16.rd new file mode 100644 index 0000000..b51eb53 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-5-16.rd @@ -0,0 +1,7 @@ +#source: pr25490-5.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+4 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-5-32.rd b/ld/testsuite/ld-elf/pr25490-5-32.rd new file mode 100644 index 0000000..8d6efb7 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-5-32.rd @@ -0,0 +1,7 @@ +#source: pr25490-5.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+8 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-5-64.rd b/ld/testsuite/ld-elf/pr25490-5-64.rd new file mode 100644 index 0000000..1375f9a --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-5-64.rd @@ -0,0 +1,7 @@ +#source: pr25490-5.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+10 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-5.s b/ld/testsuite/ld-elf/pr25490-5.s new file mode 100644 index 0000000..f9d46b8 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-5.s @@ -0,0 +1,17 @@ + .text + .type bar, %function +bar: + .section __patchable_function_entries,"awo",%progbits,bar + .dc.a .LPFE1 + .text +.LPFE1: + .byte 0 + .text + .globl _start + .type _start, %function +_start: + .section __patchable_function_entries,"awo",%progbits,_start + .dc.a .LPFE2 + .text +.LPFE2: + .byte 0 diff --git a/ld/testsuite/ld-elf/pr25490-6-16.rd b/ld/testsuite/ld-elf/pr25490-6-16.rd new file mode 100644 index 0000000..80eda13 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-6-16.rd @@ -0,0 +1,7 @@ +#source: pr25490-6.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+6 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-6-32.rd b/ld/testsuite/ld-elf/pr25490-6-32.rd new file mode 100644 index 0000000..3792842 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-6-32.rd @@ -0,0 +1,7 @@ +#source: pr25490-6.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+c +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-6-64.rd b/ld/testsuite/ld-elf/pr25490-6-64.rd new file mode 100644 index 0000000..a95ca48 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-6-64.rd @@ -0,0 +1,7 @@ +#source: pr25490-6.s +#ld: --gc-sections -e _start +#readelf: -SW + +#... + +\[ *[0-9]+\] __patchable_function_entries +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+18 +00 +WAL +[0-9] +0 +[1248] +#pass diff --git a/ld/testsuite/ld-elf/pr25490-6.s b/ld/testsuite/ld-elf/pr25490-6.s new file mode 100644 index 0000000..43fbc17 --- /dev/null +++ b/ld/testsuite/ld-elf/pr25490-6.s @@ -0,0 +1,30 @@ + .section .text,"axG",%progbits,bar,comdat + .globl bar + .type bar, %function +bar: + .section __patchable_function_entries,"awo",%progbits,bar + .dc.a .LPFE1 + .section .text,"axG",%progbits,bar,comdat +.LPFE1: + .byte 0 + .section .text,"axG",%progbits,foo,comdat + .globl foo + .type foo, %function +foo: + .section __patchable_function_entries,"awo",%progbits,foo,unique,0 + .dc.a .LPFE2 + .section .text,"axG",%progbits,foo,comdat +.LPFE2: + .byte 0 + .section .text,"axG",%progbits,_start,comdat,unique,1 + .globl _start + .type _start, %function +_start: + .section __patchable_function_entries,"awoG",%progbits,_start,_start,comdat,unique,3 + .dc.a .LPFE3 + .section .text,"axG",%progbits,_start,comdat,unique,1 +.LPFE3: + .byte 0 + .section .note,"",%note + .dc.a foo + .dc.a bar |