aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2005-10-20 19:30:23 +0000
committerAlexandre Oliva <aoliva@redhat.com>2005-10-20 19:30:23 +0000
commit8788c68fb0d692e7c09c789867e91adaef31d734 (patch)
tree371eace32311ca26ea6a068562168710b5a04b4e /gcc/varasm.c
parentf6ac9e1e61b512618240065abe2a79ab9bdfa549 (diff)
gcc/ChangeLog:
PR middle-end/24295 * cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Mark alias targets. * varasm.c (find_decl_and_mark_needed): After cgraph global info is ready, stop marking functions, but still mark variables. gcc/testsuite/ChangeLog: PR middle-end/24295 * g++.old-deja/g++.abi/vtable2.C: Do not introduce external declarations with the same names as thunks' alias targets, use aliases instead. * gcc.dg/attr-alias-3.c: New test. * gcc.dg/weak/weak-14.c, gcc.dg/weak/weak-14a.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@105688 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 1aee9839e2d..2aa5e6904da 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4560,27 +4560,28 @@ find_decl_and_mark_needed (tree decl, tree target)
struct cgraph_node *fnode = NULL;
struct cgraph_varpool_node *vnode = NULL;
- /* C++ thunk emitting code produces aliases late in the game.
- Avoid confusing cgraph code in that case. */
- if (!cgraph_global_info_ready)
+ if (TREE_CODE (decl) == FUNCTION_DECL)
{
- if (TREE_CODE (decl) == FUNCTION_DECL)
- {
- fnode = cgraph_node_for_asm (target);
- if (fnode == NULL)
- vnode = cgraph_varpool_node_for_asm (target);
- }
- else
- {
- vnode = cgraph_varpool_node_for_asm (target);
- if (vnode == NULL)
- fnode = cgraph_node_for_asm (target);
- }
+ fnode = cgraph_node_for_asm (target);
+ if (fnode == NULL)
+ vnode = cgraph_varpool_node_for_asm (target);
+ }
+ else
+ {
+ vnode = cgraph_varpool_node_for_asm (target);
+ if (vnode == NULL)
+ fnode = cgraph_node_for_asm (target);
}
if (fnode)
{
- cgraph_mark_needed_node (fnode);
+ /* We can't mark function nodes as used after cgraph global info
+ is finished. This wouldn't generally be necessary, but C++
+ virtual table thunks are introduced late in the game and
+ might seem like they need marking, although in fact they
+ don't. */
+ if (! cgraph_global_info_ready)
+ cgraph_mark_needed_node (fnode);
return fnode->decl;
}
else if (vnode)