diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-09-28 14:53:24 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-09-28 14:53:24 +0000 |
commit | dd86362472ff29dd0a3972e35b20ab0e7b1ba161 (patch) | |
tree | cab0d5b8a8665b16d5ffde07cff411b167813a50 /bfd/elf.c | |
parent | d33cdfe369f367a584e969777e27d0d191c256f6 (diff) | |
download | gdb-dd86362472ff29dd0a3972e35b20ab0e7b1ba161.zip gdb-dd86362472ff29dd0a3972e35b20ab0e7b1ba161.tar.gz gdb-dd86362472ff29dd0a3972e35b20ab0e7b1ba161.tar.bz2 |
2005-09-28 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/1321
* elf-bfd.h (_bfd_elf_setup_group_pointers): Renamed to ...
(_bfd_elf_setup_sections): This.
* elf.c: Likewise.
* elfcode.h (elf_object_p): Likewise.
* elf.c (_bfd_elf_setup_sections): Process SHF_LINK_ORDER.
(_bfd_elf_copy_private_section_data): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 40 |
1 files changed, 38 insertions, 2 deletions
@@ -626,12 +626,41 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) } bfd_boolean -_bfd_elf_setup_group_pointers (bfd *abfd) +_bfd_elf_setup_sections (bfd *abfd) { unsigned int i; unsigned int num_group = elf_tdata (abfd)->num_group; bfd_boolean result = TRUE; + asection *s; + + /* Process SHF_LINK_ORDER. */ + for (s = abfd->sections; s != NULL; s = s->next) + { + Elf_Internal_Shdr *this_hdr = &elf_section_data (s)->this_hdr; + if ((this_hdr->sh_flags & SHF_LINK_ORDER) != 0) + { + unsigned int elfsec = this_hdr->sh_link; + /* FIXME: The old Intel compiler and old strip/objcopy may + not set the sh_link or sh_info fields. Hence we could + get the situation where elfsec is 0. */ + if (elfsec == 0) + { + const struct elf_backend_data *bed + = get_elf_backend_data (abfd); + if (bed->link_order_error_handler) + bed->link_order_error_handler + (_("%B: warning: sh_link not set for section `%A'"), + abfd, s); + } + else + { + this_hdr = elf_elfsections (abfd)[elfsec]; + elf_linked_to_section (s) = this_hdr->bfd_section; + } + } + } + /* Process section groups. */ if (num_group == (unsigned) -1) return result; @@ -5665,7 +5694,14 @@ _bfd_elf_copy_private_section_data (bfd *ibfd, /* Set things up for objcopy. The output SHT_GROUP section will have its elf_next_in_group pointing back to the input group members. Ignore linker created group section. See - elfNN_ia64_object_p in elfxx-ia64.c. */ + elfNN_ia64_object_p in elfxx-ia64.c. We also need to handle + elf_linked_to_section for SHF_LINK_ORDER. */ + + if ((ihdr->sh_flags & SHF_LINK_ORDER) != 0 + && elf_linked_to_section (isec) != 0) + elf_linked_to_section (osec) + = elf_linked_to_section (isec)->output_section; + if (elf_sec_group (isec) == NULL || (elf_sec_group (isec)->flags & SEC_LINKER_CREATED) == 0) { |