diff options
author | Alan Modra <amodra@gmail.com> | 2024-04-22 09:29:28 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-04-23 22:07:00 +0930 |
commit | ef1c830f003acaf149bb9ee230be0d0067e1855c (patch) | |
tree | 7a9a5efeff511a38f4c593158424c2d5a756ad58 /ld/testsuite/ld-elf | |
parent | 6197c6f3a6f9e8b8102ba56f5f1a4cb06e1acef3 (diff) | |
download | gdb-ef1c830f003acaf149bb9ee230be0d0067e1855c.zip gdb-ef1c830f003acaf149bb9ee230be0d0067e1855c.tar.gz gdb-ef1c830f003acaf149bb9ee230be0d0067e1855c.tar.bz2 |
ignore some symbols in elf.c:swap_out_syms
The reason behind this patch was noticing that generic ELF targets
fail to remove "bar" in the recently committed ld-elf/undefweak-1
test. (Despite that, those targets pass the test due to it being too
strict when matching symbols. "bar" gets turned into a local weak
defined absolute symbol.)
swap_out_syms currently drops local section syms that are defined in
discarded sections. Extend that to also drop other symbols in
discarded sections too, even global symbols. The linker goes to quite
a lot of effort to ensure globals in discarded section take a
definition from the kept linkonce or comdat group section. So the
global sym change should only affect cases where something is quite
wrong about the set of linkonce or comdat group sections. However
that change to elf_map_symbols meant we dropped _DYNAMIC_LINK /
_DYNAMIC_LINKING for mips, a global absolute symbol given STT_SECTION
type for some reason. That problem is fixed by reverting the pr14493
change which is no longer needed due to a) BSF_SECTION_SYM_USED on
x86, and b) fixing objcopy to use copy_private_symbol_data.
bfd/
PR 14493
* elf.c (ignore_sym): Rename from ignore_section_sym. Return
true for any symbol without a section or in a discarded section.
Revert pr14493 change.
(elf_map_symbols): Tidy. Use ignore_sym on all symbols.
(swap_out_syms): Tidy.
ld/
* testsuite/ld-elf/undefweak-1.rd: Match any "bar".
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r-- | ld/testsuite/ld-elf/undefweak-1.rd | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ld/testsuite/ld-elf/undefweak-1.rd b/ld/testsuite/ld-elf/undefweak-1.rd index 5b48c13..6bf3da0 100644 --- a/ld/testsuite/ld-elf/undefweak-1.rd +++ b/ld/testsuite/ld-elf/undefweak-1.rd @@ -6,5 +6,5 @@ #failif #... -.*: 0+ +0 +FUNC +WEAK +DEFAULT +UND +bar +.* bar #pass |