mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
165f707ac8
This patch processes linker script assignment statements before ld opens DT_NEEDED libraries, in order to define symbols like __bss_start that might also be defined by a library, falsely triggering an error about "DSO missing from command line". The initial value won't be correct when assigning a symbol from dot, and I make no attempt to handle all expressions. For example, an assignment like "_start_foo = ADDR (.foo)" isn't valid until sections are laid out, so won't define _start_foo early. What's here should be enough for most common scripts, and hopefully won't perturb fragile scripts. bfd/ PR 22471 * elflink.c (_bfd_elf_merge_symbol): Allow weak symbols to override early passes over linker script symbols. * linker.c (_bfd_generic_link_add_one_symbol): Allow symbols to override early passes over linker script symbols. Clear ldscript_def on symbol definitions. ld/ PR 22471 * ldexp.c (struct definedness_hash_entry): Delete "by_script". Make "iteration" an 8-bit field, and update mask in all uses. (definedness_newfunc): Don't init "by_script". (update_definedness): Test ldscript_def rather than by_script. (is_sym_value): Likewise. (fold_name <DEFINED>): Return a result for first phase. Test ldscript_def. (fold_name <NAME>): Return a result for first phase. * ldlang.c (open_input_bfds): Process all assignments, not just defsym. (lang_process): Increment lang_statement_iteration before open_input_bfds. * testsuite/ld-mips-elf/tlsdyn-o32-1.d: Adjust for larger .dynsym. * testsuite/ld-mips-elf/tlsdyn-o32-1.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-2.got: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.d: Likewise. * testsuite/ld-mips-elf/tlsdyn-o32-3.got: Likewise.
19 lines
588 B
Plaintext
19 lines
588 B
Plaintext
|
|
.*: file format elf32-tradbigmips
|
|
|
|
DYNAMIC RELOCATION RECORDS
|
|
OFFSET TYPE VALUE
|
|
00000000 R_MIPS_NONE \*ABS\*
|
|
10000038 R_MIPS_TLS_DTPMOD32 tlsbin_gd@@Base
|
|
1000003c R_MIPS_TLS_DTPREL32 tlsbin_gd@@Base
|
|
1000002c R_MIPS_TLS_DTPMOD32 tlsvar_gd@VER_1
|
|
10000030 R_MIPS_TLS_DTPREL32 tlsvar_gd@VER_1
|
|
10000040 R_MIPS_TLS_TPREL32 tlsvar_ie@VER_1
|
|
10000034 R_MIPS_TLS_TPREL32 tlsbin_ie@@Base
|
|
|
|
|
|
Contents of section .got:
|
|
10000020 00000000 80000000 004005ec 00000000 .*
|
|
10000030 00000000 00000000 00000000 00000000 .*
|
|
10000040 00000000 00000001 00000000 .*
|