aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-02-22 01:20:48 +0000
committerH.J. Lu <hjl.tools@gmail.com>2013-02-22 01:20:48 +0000
commit35399224a1844ef745704878db6ecc83d350386d (patch)
tree947a54ed3d1e69e22b78a17eada5d81225f81019 /bfd
parent757b8d94056f339ccb81836bdc781bcf6a90dc38 (diff)
downloadgdb-35399224a1844ef745704878db6ecc83d350386d.zip
gdb-35399224a1844ef745704878db6ecc83d350386d.tar.gz
gdb-35399224a1844ef745704878db6ecc83d350386d.tar.bz2
Set unique_global only for definition
bfd/ PR ld/15167 * elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Set unique_global only for definition. * elflink.c (_bfd_elf_merge_symbol): Don't set unique_global here. (elf_link_add_object_symbols): Set unique_global only for definition. ld/testsuite/ PR ld/15167 * ld-unique/unique.exp: Add a test for shared library with reference.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elf64-ia64-vms.c3
-rw-r--r--bfd/elflink.c10
3 files changed, 16 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 72d9127..99c7c2b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2013-02-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/15167
+ * elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Set
+ unique_global only for definition.
+ * elflink.c (_bfd_elf_merge_symbol): Don't set unique_global
+ here.
+ (elf_link_add_object_symbols): Set unique_global only
+ for definition.
+
2013-02-21 Alan Modra <amodra@gmail.com>
* elf-bfd.h (struct elf_build_id): Extracted from..
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index 6747e0c..82fd646 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -5046,7 +5046,8 @@ error_free_dyn:
h = (struct elf_link_hash_entry *) h->root.u.i.link;
*sym_hash = h;
- h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
+ if (definition)
+ h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
/* Set the alignment of a common symbol. */
if ((common || bfd_is_com_section (sec))
diff --git a/bfd/elflink.c b/bfd/elflink.c
index e9ed760..ba65f21 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1262,9 +1262,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
return TRUE;
}
- if (bind == STB_GNU_UNIQUE)
- h->unique_global = 1;
-
/* If a new weak symbol definition comes from a regular file and the
old symbol comes from a dynamic library, we treat the new one as
strong. Similarly, an old weak symbol definition from a regular
@@ -4197,8 +4194,6 @@ error_free_dyn:
h = (struct elf_link_hash_entry *) h->root.u.i.link;
*sym_hash = h;
- if (is_elf_hash_table (htab))
- h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
new_weak = (flags & BSF_WEAK) != 0;
new_weakdef = FALSE;
@@ -4425,7 +4420,10 @@ error_free_dyn:
dynsym = FALSE;
if (definition)
- h->target_internal = isym->st_target_internal;
+ {
+ h->target_internal = isym->st_target_internal;
+ h->unique_global = (flags & BSF_GNU_UNIQUE) != 0;
+ }
/* Check to see if we need to add an indirect symbol for
the default name. */