diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2005-10-20 19:30:23 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2005-10-20 19:30:23 +0000 |
commit | cdcba1ea35704e2e6e9197eb8ed2f211ddccb0f3 (patch) | |
tree | 371eace32311ca26ea6a068562168710b5a04b4e /gcc/varasm.c | |
parent | 94c813b4572f371dcdb8aca1ed4bf0d37cde47a6 (diff) | |
download | gcc-cdcba1ea35704e2e6e9197eb8ed2f211ddccb0f3.zip gcc-cdcba1ea35704e2e6e9197eb8ed2f211ddccb0f3.tar.gz gcc-cdcba1ea35704e2e6e9197eb8ed2f211ddccb0f3.tar.bz2 |
re PR middle-end/24295 (Xorg broken, #pragma weak foo = bar no longer causes bar to be referenced)
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.
From-SVN: r105688
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 1aee983..2aa5e69 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) |