PATCH: PR ld/15107: Reference to GNU_UNIQUE symbol shouldn't create GNU_UNIQUE symbol
H.J. Lu
hongjiu.lu@intel.com
Thu Feb 7 18:04:00 GMT 2013
Hi,
GNU_UNIQUE controls run-time lookup. We shouldn't set GNU_UNIQUE to
undefined symbol. This is consistent with gold. OK to install?
Thanks.
H.J.
---
bfd/
2013-02-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15107
* elflink.c (elf_link_output_extsym): Set STB_GNU_UNIQUE only if
symbol is defined in regular object.
ld/testsuite/
2013-02-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15107
* ld-unique/unique_empty.s: Add reference to "b".
diff --git a/bfd/elflink.c b/bfd/elflink.c
index d336730..e6c8351 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8868,7 +8868,8 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
/* Turn off visibility on local symbol. */
sym.st_other &= ~ELF_ST_VISIBILITY (-1);
}
- else if (h->unique_global)
+ /* Set STB_GNU_UNIQUE only if symbol is defined in regular object. */
+ else if (h->unique_global && h->def_regular)
sym.st_info = ELF_ST_INFO (STB_GNU_UNIQUE, h->type);
else if (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_defweak)
diff --git a/ld/testsuite/ld-unique/unique_empty.s b/ld/testsuite/ld-unique/unique_empty.s
index efd6683..c4c52c2 100644
--- a/ld/testsuite/ld-unique/unique_empty.s
+++ b/ld/testsuite/ld-unique/unique_empty.s
@@ -1,4 +1,4 @@
.type main,"function"
.global main
main:
- .long 0
+ .dc.a b
More information about the Binutils
mailing list