diff options
author | Jan Hubicka <jh@suse.cz> | 2006-07-24 02:16:16 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2006-07-24 00:16:16 +0000 |
commit | 386b46cf78f852e82fb1f37ba271858b1f1040b3 (patch) | |
tree | 20047ee6f873662157a0d8d8f27ffbacb9260691 /gcc/cgraph.c | |
parent | 3201e73d96ae8bd6425828a807987f35f1f7bd32 (diff) | |
download | gcc-386b46cf78f852e82fb1f37ba271858b1f1040b3.zip gcc-386b46cf78f852e82fb1f37ba271858b1f1040b3.tar.gz gcc-386b46cf78f852e82fb1f37ba271858b1f1040b3.tar.bz2 |
re PR c/25795 (Proccessing the attribute externally_visible too early)
PR c/25795
PR c++/27369
* cgraph.c (cgraph_varpool_nodes): Export.
(decide_is_variable_needed): Ignored "used" attribute in
unit-at-a-time mode.
* cgraph.h (cgraph_varpool_nodes): Declare.
* cgraphunit.c (decide_is_function_needed): Ignored "used" attribute in
unit-at-a-time mode.
* gcc.dg/pr25795.c: New test.
* gcc.dg/pr25795-1.c: New test.
From-SVN: r115693
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 04ff094..5dd0afb 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -137,7 +137,7 @@ static GTY((param_is (struct cgraph_varpool_node))) htab_t cgraph_varpool_hash; struct cgraph_varpool_node *cgraph_varpool_nodes_queue, *cgraph_varpool_first_unanalyzed_node; /* The linked list of cgraph varpool nodes. */ -static GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes; +struct cgraph_varpool_node *cgraph_varpool_nodes; /* End of the varpool queue. Needs to be QTYed to work with PCH. */ static GTY(()) struct cgraph_varpool_node *cgraph_varpool_last_needed_node; @@ -843,8 +843,10 @@ bool decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl) { /* If the user told us it is used, then it must be so. */ - if (node->externally_visible - || lookup_attribute ("used", DECL_ATTRIBUTES (decl))) + if (node->externally_visible) + return true; + if (!flag_unit_at_a_time + && lookup_attribute ("used", DECL_ATTRIBUTES (decl))) return true; /* ??? If the assembler name is set by hand, it is possible to assemble @@ -861,7 +863,8 @@ decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl) /* Externally visible variables must be output. The exception is COMDAT variables that must be output only when they are needed. */ - if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl)) + if (TREE_PUBLIC (decl) && !flag_whole_program && !DECL_COMDAT (decl) + && !DECL_EXTERNAL (decl)) return true; /* When not reordering top level variables, we have to assume that |