aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-05-27 09:38:42 +0930
committerAlan Modra <amodra@gmail.com>2019-05-27 13:56:28 +0930
commit3d7d6a6ff4678685f86976f08ab4c9c639e262e1 (patch)
treed3b5ce6d4a5e6502170e32affe05d38abbb26049 /ld
parentd5b7ce35a19350969b609c56a8bfff17f91cca20 (diff)
downloadgdb-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 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/emultempl/genelf.em4
2 files changed, 9 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4de04b6..36d866f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-27 Alan Modra <amodra@gmail.com>
+
+ PR 24596
+ * emultempl/genelf.em (gld${EMULATION_NAME}_after_open): Set
+ BFS_KEEP on group signature symbol.
+
2019-04-24 Szabolcs Nagy <szabolcs.nagy@arm.com>
* testsuite/ld-aarch64/aarch64-elf.exp: Add new tests.
diff --git a/ld/emultempl/genelf.em b/ld/emultempl/genelf.em
index 472f701..664a5b1 100644
--- a/ld/emultempl/genelf.em
+++ b/ld/emultempl/genelf.em
@@ -45,7 +45,9 @@ gld${EMULATION_NAME}_after_open (void)
if ((sec->flags & (SEC_GROUP | SEC_LINKER_CREATED)) == SEC_GROUP)
{
struct bfd_elf_section_data *sec_data = elf_section_data (sec);
- elf_group_id (sec) = syms[sec_data->this_hdr.sh_info - 1];
+ struct bfd_symbol *sym = syms[sec_data->this_hdr.sh_info - 1];
+ elf_group_id (sec) = sym;
+ sym->flags |= BSF_KEEP;
}
}