Browse Source
The testcases added here show situations where synthesized start/stop symbols don't cause their associated input sections to be marked. Fixed with the elflink.c and ldlang.c changes. bfd/ PR 27500 * elflink.c (_bfd_elf_gc_mark_rsec): Do special start/stop processing not when start/stop symbol section is unmarked but on first time a start/stop symbol is processed. ld/ * ldlang.c (insert_undefined): Don't mark symbols here. (lang_mark_undefineds): Do so here instead, new function. (lang_process): Call lang_mark_undefineds. * testsuite/ld-gc/start3.d, * testsuite/ld-gc/start3.s: New test. * testsuite/ld-gc/start4.d, * testsuite/ld-gc/start4.s: New test. * testsuite/ld-gc/gc.exp: Run them.binutils-2_37-branch
9 changed files with 112 additions and 4 deletions
@ -0,0 +1,9 @@ |
|||
#name: --gc-sections with groups and start/stop syms |
|||
#ld: --gc-sections -e _start |
|||
#nm: -n |
|||
#notarget: [is_generic] |
|||
#xfail: bfin-*-*linux* frv-*-*linux* lm32-*-*linux* |
|||
|
|||
#... |
|||
[0-9a-f]+ T +bar |
|||
#... |
|||
@ -0,0 +1,29 @@ |
|||
.text |
|||
.global _start |
|||
_start: |
|||
.dc.a foo |
|||
.ifdef UNDERSCORE |
|||
.dc.a ___start_xx, ___stop_xx |
|||
.else |
|||
.dc.a __start_xx, __stop_xx |
|||
.endif |
|||
|
|||
.section .text,"axG",%progbits,foo_group |
|||
.global foo |
|||
foo: |
|||
.dc.a 0 |
|||
|
|||
.section xx,"aG",%progbits,foo_group |
|||
.global foo_xx |
|||
foo_xx: |
|||
.dc.a 1 |
|||
|
|||
.section .text,"axG",%progbits,bar_group |
|||
.global bar |
|||
bar: |
|||
.dc.a 2 |
|||
|
|||
.section xx,"aG",%progbits,bar_group |
|||
.global bar_xx |
|||
bar_xx: |
|||
.dc.a 3 |
|||
@ -0,0 +1,9 @@ |
|||
#name: --gc-sections with other syms and start/stop syms |
|||
#ld: --gc-sections -e _start |
|||
#nm: -n |
|||
#target: [supports_gnu_unique] |
|||
#xfail: bfin-*-*linux* frv-*-*linux* lm32-*-*linux* |
|||
|
|||
#... |
|||
[0-9a-f]+ R +bar_xx |
|||
#... |
|||
@ -0,0 +1,19 @@ |
|||
.text |
|||
.global _start |
|||
_start: |
|||
.dc.a foo_xx |
|||
.ifdef UNDERSCORE |
|||
.dc.a ___start_xx, ___stop_xx |
|||
.else |
|||
.dc.a __start_xx, __stop_xx |
|||
.endif |
|||
|
|||
.section xx,"a",%progbits,unique,0 |
|||
.global foo_xx |
|||
foo_xx: |
|||
.dc.a 1 |
|||
|
|||
.section xx,"a",%progbits,unique,1 |
|||
.global bar_xx |
|||
bar_xx: |
|||
.dc.a 3 |
|||
Loading…
Reference in new issue