]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* lto.c (globalize_cross_file_statics): When function has address taken,
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Apr 2010 14:41:03 +0000 (14:41 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Apr 2010 14:41:03 +0000 (14:41 +0000)
it needs to be public.
* varpool.c (decide_is_variable_needed): Variable is always needed
during ltrans.

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

gcc/ChangeLog
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/varpool.c

index 1fe4172587a6aa614047a9c4e10cb6f377d107a9..13ac23956aaaf5348cc9db724aa17b5e73c46d9f 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-21  Jan Hubicka  <jh@suse.cz>
+
+       * varpool.c (decide_is_variable_needed): Variable is always needed
+       during ltrans.
+
 2010-04-21  Jan Hubicka  <jh@suse.cz>
 
        * opts.c (decode_options): Enable pure-const pass for whopr.
index 9118e0045ea7eda189b52603468bac5e0bed6b87..a97314c928be134ac0bdb1be1413060a16cec766 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-21  Jan Hubicka  <jh@suse.cz>
+
+       * lto.c (globalize_cross_file_statics): When function has address taken,
+       it needs to be public.
+
 2010-04-20  Jan Hubicka  <jh@suse.cz>
 
        * lto.c (lto_add_inline_clones): Do not track inlined_decls.
index 1544f05ab4fc381e58af99964b1d66d6ae6de320..ea8f03a131db12e754ab177389fde6c6f4a96892 100644 (file)
@@ -760,7 +760,8 @@ globalize_cross_file_statics (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
     }
   else if (TREE_CODE (t) == FUNCTION_DECL && !TREE_PUBLIC (t))
     {
-      if (!cgraph_node_in_set_p (cgraph_node (t), context->set))
+      if (!cgraph_node_in_set_p (cgraph_node (t), context->set)
+         || cgraph_node (t)->address_taken)
        {
          /* This file-scope static function is reachable from a set
             which does not contain the function DECL.  Make it global
index a13742d4957aeddf6333b3d6a67a8f253ff49795..40decfc867b542c6eacdfc561f8b69baf581cbdf 100644 (file)
@@ -230,6 +230,12 @@ varpool_reset_queue (void)
 bool
 decide_is_variable_needed (struct varpool_node *node, tree decl)
 {
+  /* We do not track variable references at all and thus have no idea if the
+     variable was referenced in some other partition or not.  
+     FIXME: We really need address taken edges in callgraph and varpool to
+     drive WPA and decide whether other partition might reference it or not.  */
+  if (flag_ltrans)
+    return true;
   /* If the user told us it is used, then it must be so.  */
   if ((node->externally_visible && !DECL_COMDAT (decl))
       || node->force_output)