diff options
author | Alan Modra <amodra@gmail.com> | 2019-05-27 09:38:42 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-05-27 13:56:28 +0930 |
commit | 3d7d6a6ff4678685f86976f08ab4c9c639e262e1 (patch) | |
tree | d3b5ce6d4a5e6502170e32affe05d38abbb26049 /bfd/linker.c | |
parent | d5b7ce35a19350969b609c56a8bfff17f91cca20 (diff) | |
download | gdb-3d7d6a6ff4678685f86976f08ab4c9c639e262e1.zip gdb-3d7d6a6ff4678685f86976f08ab4c9c639e262e1.tar.gz gdb-3d7d6a6ff4678685f86976f08ab4c9c639e262e1.tar.bz2 |
Generic ELF target group signature symbol
Even though the generic ELF target doesn't handle groups correctly,
this helps avoid a segfault in bfd_elf_set_group_contents seen on
d30v-elf, dlx-elf, pj-elf, and xgate-elf when linking the pr22836
testcase.
PR 24596
bfd/
* linker.c (_bfd_generic_link_output_symbols): Heed BSF_KEEP.
ld/
* emultempl/genelf.em (gld${EMULATION_NAME}_after_open): Set
BFS_KEEP on group signature symbol.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r-- | bfd/linker.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bfd/linker.c b/bfd/linker.c index 9e89c84..1b71fcf 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -2112,12 +2112,11 @@ _bfd_generic_link_output_symbols (bfd *output_bfd, } } - /* This switch is straight from the old code in - write_file_locals in ldsym.c. */ - if (info->strip == strip_all - || (info->strip == strip_some - && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym), - FALSE, FALSE) == NULL)) + if ((sym->flags & BSF_KEEP) == 0 + && (info->strip == strip_all + || (info->strip == strip_some + && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym), + FALSE, FALSE) == NULL))) output = FALSE; else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0) { @@ -2131,6 +2130,8 @@ _bfd_generic_link_output_symbols (bfd *output_bfd, else output = FALSE; } + else if ((sym->flags & BSF_KEEP) != 0) + output = TRUE; else if (bfd_is_ind_section (sym->section)) output = FALSE; else if ((sym->flags & BSF_DEBUGGING) != 0) |