From: Alan Modra Date: Sun, 28 Sep 2008 13:30:35 +0000 (+0000) Subject: * elf.c (_bfd_elf_init_private_section_data): Tweak union copy. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9659de1cb3549b08d49ab6652a6569a7408b8361;p=binutils-gdb.git * elf.c (_bfd_elf_init_private_section_data): Tweak union copy. (bfd_section_from_shdr): Don't change SHT_GROUP section name. * elflink.c (section_signature): New function. (_bfd_elf_section_already_linked): Use it. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 25214d854e0..7ca4070a5cf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2008-09-28 Alan Modra + + * elf.c (_bfd_elf_init_private_section_data): Tweak union copy. + (bfd_section_from_shdr): Don't change SHT_GROUP section name. + * elflink.c (section_signature): New function. + (_bfd_elf_section_already_linked): Use it. + 2008-09-19 Alan Modra * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Handle vxworks diff --git a/bfd/elf.c b/bfd/elf.c index 7f9853e6540..e8c6c239acb 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1863,14 +1863,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) return TRUE; case SHT_GROUP: - /* We need a BFD section for objcopy and relocatable linking, - and it's handy to have the signature available as the section - name. */ if (! IS_VALID_GROUP_SECTION_HEADER (hdr)) return FALSE; - name = group_signature (abfd, hdr); - if (name == NULL) - return FALSE; if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; if (hdr->contents != NULL) @@ -6019,7 +6013,7 @@ _bfd_elf_init_private_section_data (bfd *ibfd, if (elf_section_flags (isec) & SHF_GROUP) elf_section_flags (osec) |= SHF_GROUP; elf_next_in_group (osec) = elf_next_in_group (isec); - elf_group_name (osec) = elf_group_name (isec); + elf_section_data (osec)->group = elf_section_data (isec)->group; } } diff --git a/bfd/elflink.c b/bfd/elflink.c index ab6c2dbb8ee..1c7f79a0c20 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -11997,8 +11997,21 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) return ret; } +/* For a SHT_GROUP section, return the group signature. For other + sections, return the normal section name. */ + +static const char * +section_signature (asection *sec) +{ + if ((sec->flags & SEC_GROUP) != 0 + && elf_next_in_group (sec) != NULL + && elf_group_name (elf_next_in_group (sec)) != NULL) + return elf_group_name (elf_next_in_group (sec)); + return sec->name; +} + void -_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec, +_bfd_elf_section_already_linked (bfd *abfd, asection *sec, struct bfd_link_info *info) { flagword flags; @@ -12038,7 +12051,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec, causes trouble for MIPS ELF, which relies on link once semantics to handle the .reginfo section correctly. */ - name = bfd_get_section_name (abfd, sec); + name = section_signature (sec); if (CONST_STRNEQ (name, ".gnu.linkonce.") && (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL) @@ -12053,7 +12066,7 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section *sec, /* We may have 2 different types of sections on the list: group sections and linkonce sections. Match like sections. */ if ((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP) - && strcmp (name, l->sec->name) == 0 + && strcmp (name, section_signature (l->sec)) == 0 && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL) { /* The section has already been linked. See if we should