summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2013-08-21 04:09:30 +0000
committerAlan Modra <amodra@bigpond.net.au>2013-08-21 04:09:30 +0000
commita3caf600506466f458e83818058c34dbf29d5de8 (patch)
tree7e5c9b25632149007b87d1851b8d02037e3f515b /bfd
parent72371c5ce3490437d6b47aeb9090529611415f53 (diff)
downloadgdb-a3caf600506466f458e83818058c34dbf29d5de8.tar.gz
* elflink.c (_bfd_elf_merge_symbol): Set *poldbfd, *poldweak,
and *poldalignment before exiting when !relocs_compatible.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c87
2 files changed, 48 insertions, 44 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 48782783e89..3c36e070c1b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2013-08-21 Alan Modra <amodra@gmail.com>
+ * elflink.c (_bfd_elf_merge_symbol): Set *poldbfd, *poldweak,
+ and *poldalignment before exiting when !relocs_compatible.
+
+2013-08-21 Alan Modra <amodra@gmail.com>
+
* elflink.c (_bfd_elf_define_linkage_sym): Don't set STV_INTERNAL
symbols to STV_HIDDEN.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 20371bc2255..c22f7e8ad6a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -951,11 +951,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
bed = get_elf_backend_data (abfd);
- /* This code is for coping with dynamic objects, and is only useful
- if we are doing an ELF link. */
- if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
- return TRUE;
-
/* For merging, we only care about real symbols. But we need to make
sure that indirect symbol dynamic flags are updated. */
hi = h;
@@ -963,6 +958,49 @@ _bfd_elf_merge_symbol (bfd *abfd,
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ /* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the
+ existing symbol. */
+
+ oldbfd = NULL;
+ oldsec = NULL;
+ switch (h->root.type)
+ {
+ default:
+ break;
+
+ case bfd_link_hash_undefined:
+ case bfd_link_hash_undefweak:
+ oldbfd = h->root.u.undef.abfd;
+ break;
+
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ oldbfd = h->root.u.def.section->owner;
+ oldsec = h->root.u.def.section;
+ break;
+
+ case bfd_link_hash_common:
+ oldbfd = h->root.u.c.p->section->owner;
+ oldsec = h->root.u.c.p->section;
+ if (pold_alignment)
+ *pold_alignment = h->root.u.c.p->alignment_power;
+ break;
+ }
+ if (poldbfd && *poldbfd == NULL)
+ *poldbfd = oldbfd;
+
+ /* Differentiate strong and weak symbols. */
+ newweak = bind == STB_WEAK;
+ oldweak = (h->root.type == bfd_link_hash_defweak
+ || h->root.type == bfd_link_hash_undefweak);
+ if (pold_weak)
+ *pold_weak = oldweak;
+
+ /* This code is for coping with dynamic objects, and is only useful
+ if we are doing an ELF link. */
+ if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
+ return TRUE;
+
/* We have to check it for every instance since the first few may be
references and not all compilers emit symbol type for undefined
symbols. */
@@ -1007,45 +1045,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
return TRUE;
}
- /* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the
- existing symbol. */
-
- switch (h->root.type)
- {
- default:
- oldbfd = NULL;
- oldsec = NULL;
- break;
-
- case bfd_link_hash_undefined:
- case bfd_link_hash_undefweak:
- oldbfd = h->root.u.undef.abfd;
- oldsec = NULL;
- break;
-
- case bfd_link_hash_defined:
- case bfd_link_hash_defweak:
- oldbfd = h->root.u.def.section->owner;
- oldsec = h->root.u.def.section;
- break;
-
- case bfd_link_hash_common:
- oldbfd = h->root.u.c.p->section->owner;
- oldsec = h->root.u.c.p->section;
- if (pold_alignment)
- *pold_alignment = h->root.u.c.p->alignment_power;
- break;
- }
- if (poldbfd && *poldbfd == NULL)
- *poldbfd = oldbfd;
-
- /* Differentiate strong and weak symbols. */
- newweak = bind == STB_WEAK;
- oldweak = (h->root.type == bfd_link_hash_defweak
- || h->root.type == bfd_link_hash_undefweak);
- if (pold_weak)
- *pold_weak = oldweak;
-
/* In cases involving weak versioned symbols, we may wind up trying
to merge a symbol with itself. Catch that here, to avoid the
confusion that results if we try to override a symbol with