From 02acbe2250b647ae693a88fa30056f80aee514d9 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 8 Feb 2013 01:33:01 +0000 Subject: [PATCH] Set STB_GNU_UNIQUE only if symbol is defined in regular object bfd/ PR ld/15107 * elflink.c (elf_link_output_extsym): Set STB_GNU_UNIQUE only if symbol is defined in regular object. ld/testsuite/ PR ld/15107 * ld-unique/unique_empty.s: Add reference to "b". --- bfd/ChangeLog | 6 ++++++ bfd/elflink.c | 3 ++- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-unique/unique_empty.s | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c652c3523d7..4c936117c16 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2013-02-07 H.J. Lu + + PR ld/15107 + * elflink.c (elf_link_output_extsym): Set STB_GNU_UNIQUE only if + symbol is defined in regular object. + 2013-02-07 Roberto Agostino Vitillo PR binutils/15106 diff --git a/bfd/elflink.c b/bfd/elflink.c index d336730e078..e6c835153fb 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/ChangeLog b/ld/testsuite/ChangeLog index 2c12a52678a..c031a5edd3a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-07 H.J. Lu + + PR ld/15107 + * ld-unique/unique_empty.s: Add reference to "b". + 2013-02-06 H.J. Lu * ld-size/size-10.rd: Updated. diff --git a/ld/testsuite/ld-unique/unique_empty.s b/ld/testsuite/ld-unique/unique_empty.s index efd66839bce..c4c52c2cda6 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 -- 2.30.2