re PR middle-end/41729 (Undefined reference with -fPIC -fwhole-program -flto)
PR middle-end/41729 * ipa.c (function_and_variable_visibility): Do not privatize COMDAT and WEAK variables at -fwhole-program. PR middle-end/41735 * ipa.c (whole_program_function_and_variable_visility): COMDAT functions/variables are not needed even if they are externally visible. From-SVN: r154108
This commit is contained in:
parent
ef2bbc8c9a
commit
62a0a52e35
2 changed files with 18 additions and 2 deletions
|
@ -1,3 +1,13 @@
|
|||
2009-11-11 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR middle-end/41729
|
||||
* ipa.c (function_and_variable_visibility): Do not privatize COMDAT
|
||||
and WEAK variables at -fwhole-program.
|
||||
|
||||
PR middle-end/41735
|
||||
* ipa.c (whole_program_function_and_variable_visility): COMDAT
|
||||
functions/variables are not needed even if they are externally visible.
|
||||
|
||||
2009-11-11 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
(patch by Richard Guenther)
|
||||
|
|
10
gcc/ipa.c
10
gcc/ipa.c
|
@ -319,6 +319,11 @@ function_and_variable_visibility (bool whole_program)
|
|||
if (vnode->needed
|
||||
&& (DECL_COMDAT (vnode->decl) || TREE_PUBLIC (vnode->decl))
|
||||
&& (!whole_program
|
||||
/* We can privatize comdat readonly variables whose address is not taken,
|
||||
but doing so is not going to bring us optimization oppurtunities until
|
||||
we start reordering datastructures. */
|
||||
|| DECL_COMDAT (vnode->decl)
|
||||
|| DECL_WEAK (vnode->decl)
|
||||
|| lookup_attribute ("externally_visible",
|
||||
DECL_ATTRIBUTES (vnode->decl))))
|
||||
vnode->externally_visible = true;
|
||||
|
@ -396,10 +401,11 @@ whole_program_function_and_variable_visibility (void)
|
|||
function_and_variable_visibility (flag_whole_program);
|
||||
|
||||
for (node = cgraph_nodes; node; node = node->next)
|
||||
if (node->local.externally_visible && node->local.finalized)
|
||||
if ((node->local.externally_visible && !DECL_COMDAT (node->decl))
|
||||
&& node->local.finalized)
|
||||
cgraph_mark_needed_node (node);
|
||||
for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed)
|
||||
if (vnode->externally_visible)
|
||||
if (vnode->externally_visible && !DECL_COMDAT (vnode->decl))
|
||||
varpool_mark_needed_node (vnode);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue