PR middle-end/65074
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Feb 2015 15:14:24 +0000 (15:14 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Feb 2015 15:14:24 +0000 (15:14 +0000)
 * varasm.c (default_binds_local_p_2): Don't test node->definition;
 test DECL_EXTERNAL independent of symtab_node.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220816 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/varasm.c

index a304558..ac52a2c 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-19  Richard Henderson  <rth@redhat.com>
+
+       PR middle-end/65074
+       * varasm.c (default_binds_local_p_2): Don't test node->definition;
+       test DECL_EXTERNAL independent of symtab_node.
+
 2015-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR lto/65012
index dc7cfd7..8173207 100644 (file)
@@ -6828,20 +6828,18 @@ default_binds_local_p_2 (const_tree exp, bool shlib, bool weak_dominate)
      because dynamic linking might overwrite symbols
      in shared libraries.  */
   bool resolved_locally = false;
-  bool defined_locally = false;
+  bool defined_locally = !DECL_EXTERNAL (exp);
   if (symtab_node *node = symtab_node::get (exp))
     {
-      if ((node->definition && !DECL_EXTERNAL (node->decl))
-         || node->in_other_partition)
-       {
-         defined_locally = true;
-         resolved_locally = (weak_dominate && !shlib);
-       }
+      if (node->in_other_partition)
+       defined_locally = true;
       if (resolution_to_local_definition_p (node->resolution))
        defined_locally = resolved_locally = true;
       else if (resolution_local_p (node->resolution))
        resolved_locally = true;
     }
+  if (defined_locally && weak_dominate && !shlib)
+    resolved_locally = true;
 
   /* Undefined weak symbols are never defined locally.  */
   if (DECL_WEAK (exp) && !defined_locally)