re PR middle-end/65074 (r220674 broke C++ PIEs)
authorRichard Henderson <rth@redhat.com>
Thu, 19 Feb 2015 15:14:24 +0000 (07:14 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 19 Feb 2015 15:14:24 +0000 (07:14 -0800)
PR middle-end/65074

 * varasm.c (default_binds_local_p_2): Don't test node->definition;
 test DECL_EXTERNAL independent of symtab_node.

From-SVN: r220816

gcc/ChangeLog
gcc/varasm.c

index a3045581944c1d3fd55e5db7e3f3f103e50120d3..ac52a2cc6e8d50de3cbc78edc09a094e4fa31d90 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 dc7cfd7acdeeb74bd83afc841af510f896ee158c..8173207b497f19f006b2089703e57e26efa667b0 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)