From: Vladimir Mezentsev <vladimir.mezent...@oracle.com>

When weakref_targets is not empty a target cannot be removed from weak_decls.
A small example is below when 'wv12' is removed from the weak list on aarch64:
  static vtype Wv12 __attribute__((weakref ("wv12")));
  extern vtype wv12 __attribute__((weak));

Bootstrapped on aarch64-unknown-linux-gnu including (c,c++ and go).
Tested on aarch64-linux-gnu.
No regression. The attr-weakref-1.c test passed.

ChangeLog:
2018-04-12  Vladimir Mezentsev  <vladimir.mezent...@oracle.com>

PR gcc/84923
* varasm.c (weak_finish): clean up weak_decls
---
 gcc/varasm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/varasm.c b/gcc/varasm.c
index d24bac4..2a70234 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5683,8 +5683,7 @@ weak_finish (void)
           nor multiple .weak directives for the latter.  */
        for (p = &weak_decls; (t2 = *p) ; )
          {
-           if (TREE_VALUE (t2) == alias_decl
-               || target == DECL_ASSEMBLER_NAME (TREE_VALUE (t2)))
+           if (TREE_VALUE (t2) == alias_decl)
              *p = TREE_CHAIN (t2);
            else
              p = &TREE_CHAIN (t2);
-- 
1.8.3.1

Reply via email to