diff options
Diffstat (limited to 'ld/emultempl/genelf.em')
-rw-r--r-- | ld/emultempl/genelf.em | 20 |
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 |