aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-09-28 13:30:35 +0000
committerAlan Modra <amodra@gmail.com>2008-09-28 13:30:35 +0000
commit9659de1cb3549b08d49ab6652a6569a7408b8361 (patch)
treeb3bef282dc65f3e31279fe35641e33decbdd3af6 /bfd/elflink.c
parent119f42450026294aa95b7dff3fe48bf76102602f (diff)
downloadgdb-9659de1cb3549b08d49ab6652a6569a7408b8361.zip
gdb-9659de1cb3549b08d49ab6652a6569a7408b8361.tar.gz
gdb-9659de1cb3549b08d49ab6652a6569a7408b8361.tar.bz2
* 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.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ab6c2db..1c7f79a 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