re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
authorJan Hubicka <hubicka@ucw.cz>
Tue, 8 Dec 2015 22:01:41 +0000 (23:01 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 8 Dec 2015 22:01:41 +0000 (22:01 +0000)
PR ipa/61886
* ipa-visibility.c (can_replace_by_local_alias): Look through transparent
aliaes; refuse weakrefs.
(update_visibility_by_resolution_info): Skip transparent aliases in the
analysis part

From-SVN: r231428

gcc/ChangeLog
gcc/ipa-visibility.c

index e4c720774ddeb04270678c817fc92b9f48c95e5a..8554091625c017bfed8251dc244c02105c7fc823 100644 (file)
@@ -1,3 +1,11 @@
+2015-12-08  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/61886
+       * ipa-visibility.c (can_replace_by_local_alias): Look through transparent
+       aliaes; refuse weakrefs.
+       (update_visibility_by_resolution_info): Skip transparent aliases in the
+       analysis part
+
 2015-12-08  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/61886
index 0423f242af06af937d9319efb2cd72f9f2b0ee10..5b03159197ce8d00d594a4dfee90e14ca1cadfe6 100644 (file)
@@ -332,6 +332,13 @@ varpool_node::externally_visible_p (void)
 bool
 can_replace_by_local_alias (symtab_node *node)
 {
+  /* Weakrefs have a reason to be non-local.  Be sure we do not replace
+     them.  */
+  while (node->transparent_alias && node->definition && !node->weakref)
+    node = node->get_alias_target ();
+  if (node->weakref)
+    return false;
+  
   return (node->get_availability () > AVAIL_INTERPOSABLE
          && !decl_binds_to_current_def_p (node->decl)
          && !node->can_be_discarded_p ());
@@ -392,7 +399,7 @@ update_visibility_by_resolution_info (symtab_node * node)
     for (symtab_node *next = node->same_comdat_group;
         next != node; next = next->same_comdat_group)
       {
-       if (!next->externally_visible)
+       if (!next->externally_visible || next->transparent_alias)
          continue;
 
        bool same_def