aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/genelf.em
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-10-03 09:40:49 +0000
committerAlan Modra <amodra@gmail.com>2008-10-03 09:40:49 +0000
commitbcacc0f587e22ba46333d9377e7e9e4576c90f74 (patch)
tree0035a6958c007460d3837b1e245b5f89edeb3661 /ld/emultempl/genelf.em
parent81ab4297b7f533d6750f073cad0fe6169f567e85 (diff)
downloadgdb-bcacc0f587e22ba46333d9377e7e9e4576c90f74.zip
gdb-bcacc0f587e22ba46333d9377e7e9e4576c90f74.tar.gz
gdb-bcacc0f587e22ba46333d9377e7e9e4576c90f74.tar.bz2
bfd/
* elf.c (bfd_elf_set_group_contents): Assign sh_info for ld -r when the signature symbol is global. * elflink.c (elf_link_input_bfd): Ensure group signature symbol is output when ld -r. Set group sh_info when local. * linker.c (default_indirect_link_order): Handle group sections specially. ld/ * ldemul.c (ldemul_place_orphan): Add "name" param. * ldemul.h (ldemul_place_orphan): Update prototype. (struct ld_emulation_xfer_struct <place_orphan>): Likewise. * ldlang.c (lang_place_orphans): Generate unique section names here.. * emultempl/elf32.em (place_orphan): ..rather than here. Don't directly use an existing output section statement that has no bfd section. * emultempl/pe.em (place_orphan): Likewise. * emultempl/pep.em (place_orphan): Likewise. * emultempl/beos.em (place_orphan): Adjust. * emultempl/spuelf.em (spu_place_special_section): Adjust place_orphan call. * emultempl/genelf.em (gld${EMULATION_NAME}_after_open): New function. (LDEMUL_AFTER_OPEN): Define.
Diffstat (limited to 'ld/emultempl/genelf.em')
-rw-r--r--ld/emultempl/genelf.em20
1 files changed, 20 insertions, 0 deletions
diff --git a/ld/emultempl/genelf.em b/ld/emultempl/genelf.em
index e44bb9b..e6e8841 100644
--- a/ld/emultempl/genelf.em
+++ b/ld/emultempl/genelf.em
@@ -34,7 +34,27 @@ gld${EMULATION_NAME}_finish (void)
gld${EMULATION_NAME}_map_segments (FALSE);
finish_default ();
}
+
+static void
+gld${EMULATION_NAME}_after_open (void)
+{
+ bfd *ibfd;
+ asection *sec;
+ asymbol **syms;
+
+ if (link_info.relocatable)
+ for (ibfd = link_info.input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ if ((syms = bfd_get_outsymbols (ibfd)) != NULL
+ && bfd_get_flavour (ibfd) == bfd_target_elf_flavour)
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ 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];
+ }
+}
EOF
# Put these extra routines in ld_${EMULATION_NAME}_emulation
#
LDEMUL_FINISH=gld${EMULATION_NAME}_finish
+LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open