summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mmix
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-10-11 18:13:04 +1030
committerAlan Modra <amodra@gmail.com>2016-10-11 18:13:04 +1030
commitf02cb058822459ea29a9fdaa928c2623df435908 (patch)
tree1345ed2dd4496afc5d7a62981e881c0bda413908 /ld/testsuite/ld-mmix
parent3b202c10808fa17200aaeb8eb9935d94e622e671 (diff)
downloadbinutils-gdb-f02cb058822459ea29a9fdaa928c2623df435908.tar.gz
Always descend into output section statements in lang_do_assignments
See https://sourceware.org/ml/binutils/2016-07/msg00091.html This patch stop --gc-sections elf_gc_sweep_symbol localizing symbols that ought to remain global. The difficulty with always descending into output section statements is that symbols defined by the script in such statements don't have a bfd section when lang_do_assignments runs early in the link process. There are two approaches to curing this problem. Either we can create the bfd section early, or we can use a special section. This patch takes the latter approach and uses bfd_und_section. (Creating bfd sections early results in changed output section order, and thus lots of testsuite failures. You can't create all output sections early to ensure proper ordering as KEEP then stops empty sections from being stripped.) The wrinkle with this approach is that some code that runs at gc-sections time needs to be made aware of the odd defined symbols using bfd_und_section. bfd/ * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Handle symbols defined temporarily with bfd_und_section. * elflink.c (_bfd_elf_gc_keep): Don't set SEC_KEEP for bfd_und_section. * elfxx-mips.c (mips_elf_local_pic_function_p): Exclude defined symbols with bfd_und_section. ld/ * ldlang.c (lang_do_assignments_1): Descend into output section statements that do not yet have bfd sections. Set symbol section temporarily for symbols defined in such statements to the undefined section. Don't error on data or reloc statements until final phase. * ldexp.c (exp_fold_tree_1 <etree_assign>): Handle bfd_und_section in expld.section. * testsuite/ld-mmix/bpo-10.d: Adjust. * testsuite/ld-mmix/bpo-11.d: Adjust.
Diffstat (limited to 'ld/testsuite/ld-mmix')
-rw-r--r--ld/testsuite/ld-mmix/bpo-10.d3
-rw-r--r--ld/testsuite/ld-mmix/bpo-11.d3
2 files changed, 2 insertions, 4 deletions
diff --git a/ld/testsuite/ld-mmix/bpo-10.d b/ld/testsuite/ld-mmix/bpo-10.d
index 1cb7d611eea..6f49287e588 100644
--- a/ld/testsuite/ld-mmix/bpo-10.d
+++ b/ld/testsuite/ld-mmix/bpo-10.d
@@ -14,11 +14,10 @@ SYMBOL TABLE:
0+7f8 l +d \.MMIX.reg_contents 0+ (|\.MMIX\.reg_contents)
0+ l df \*ABS\* 0+ .*
0+ l \.init 0+ _start
-0+ l df \*ABS\* 0+ .*
-0+4 l \.init 0+ _start\.
2000000000000000 g \.init 0+ __bss_start
2000000000000000 g \.init 0+ _edata
2000000000000000 g \.init 0+ _end
+0+4 g \.init 0+ _start\.
Contents of section \.init:
0000 e37704a6 .*
diff --git a/ld/testsuite/ld-mmix/bpo-11.d b/ld/testsuite/ld-mmix/bpo-11.d
index 9b38be8913b..1abf38140d6 100644
--- a/ld/testsuite/ld-mmix/bpo-11.d
+++ b/ld/testsuite/ld-mmix/bpo-11.d
@@ -16,13 +16,12 @@ SYMBOL TABLE:
0+7e8 l d \.MMIX\.reg_contents 0+ (|\.MMIX\.reg_contents)
0+ l df \*ABS\* 0+ .*
0+ l \.init 0+ _start
-0+ l df \*ABS\* 0+ .*
-0+10 l \.text 0+ _start\.
0+14 g \.text 0+ x
0+10 g \.text 0+ x2
2000000000000000 g \.text 0+ __bss_start
2000000000000000 g \.text 0+ _edata
2000000000000000 g \.text 0+ _end
+0+10 g \.text 0+ _start\.
Contents of section \.init:
0000 00000000 0000003d 00000000 0000003a .*