diff options
author | Alan Modra <amodra@gmail.com> | 2010-02-19 01:47:16 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-02-19 01:47:16 +0000 |
commit | d0bf826b37bdeb1ad98dc2d601b450bd5b9043e5 (patch) | |
tree | 6228351f86e84b5f27cf405eaa860fb830cc861a /bfd/elflink.c | |
parent | 220453ec97481311a3cfd0d1a191c1bfe24f3b53 (diff) | |
download | gdb-d0bf826b37bdeb1ad98dc2d601b450bd5b9043e5.zip gdb-d0bf826b37bdeb1ad98dc2d601b450bd5b9043e5.tar.gz gdb-d0bf826b37bdeb1ad98dc2d601b450bd5b9043e5.tar.bz2 |
bfd/
* elf.c (_bfd_elf_fixup_group_sections): New function, split out from..
(_bfd_elf_copy_private_header_data): ..here.
* elflink.c (_bfd_elf_size_group_sections): New function.
(bfd_elf_size_dynamic_sections): Call it.
* elf-bfd.h (_bfd_elf_size_group_sections): Declare.
(_bfd_elf_fixup_group_sections): Declare.
ld/
* ldlang.c (unique_section_p): Add os param. Allow group
sections to match /DISCARD/. Update all callers.
* emultempl/genelf.em (gld${EMULATION_NAME}_before_allocation): New.
(LDEMUL_BEFORE_ALLOCATION): Define.
ld/testsuite/
* ld-elf/group.ld: Discard .dropme sections.
* ld-elf/group10.d, * ld-elf/group10.s: New test.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index a325c00..9fb347b 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -5481,6 +5481,20 @@ compute_bucket_count (struct bfd_link_info *info, return best_size; } +/* Size any SHT_GROUP section for ld -r. */ + +bfd_boolean +_bfd_elf_size_group_sections (struct bfd_link_info *info) +{ + bfd *ibfd; + + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour + && !_bfd_elf_fixup_group_sections (ibfd, bfd_abs_section_ptr)) + return FALSE; + return TRUE; +} + /* Set up the sizes and contents of the ELF dynamic sections. This is called by the ELF linker emulation before_allocation routine. We must set the sizes of the sections before the linker sets the @@ -5555,6 +5569,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, elf_hash_table (info)->init_plt_refcount = elf_hash_table (info)->init_plt_offset; + if (info->relocatable + && !_bfd_elf_size_group_sections (info)) + return FALSE; + /* The backend may have to create some sections regardless of whether we're dynamic or not. */ if (bed->elf_backend_always_size_sections |