diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-02 07:52:31 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-02 07:52:31 +0000 |
commit | 8bc09a747fed4c300f335b0bca7723e55fd19091 (patch) | |
tree | 9fcf4185c5360e802ff2cef25c68d1cd2b7178d6 /gcc/varasm.c | |
parent | c838448c89657e91d35e22ee3b3686410bf32c74 (diff) | |
download | gcc-8bc09a747fed4c300f335b0bca7723e55fd19091.tar.gz |
PR c/19031
* c-decl.c (pop_file_scope): Call maybe_apply_pending_pragma_weaks.
* c-lang.c (finish_file): Don't do it here.
* objc/objc-act.c (objc_finish_file): Likewise.
* cgraph.c (decl_assembler_name_equal): New.
(cgraph_node_for_asm, cgraph_varpool_node_for_asm): New.
(cgraph_varpool_node): Actually link up cgraph_varpool_nodes.
* cgraph.h (struct cgraph_varpool_node): Add next.
(cgraph_node_for_asm, cgraph_varpool_node_for_asm): Declare.
* varasm.c (assemble_alias): Mark the target as needed.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92803 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 362abafa032..7c58b98f826 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4344,7 +4344,7 @@ globalize_decl (tree decl) the symbol for TARGET. */ void -assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED) +assemble_alias (tree decl, tree target) { const char *name; @@ -4395,6 +4395,44 @@ assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED) #endif #endif + /* Tell cgraph that the aliased symbol is needed. We *could* be more + specific and tell cgraph about the relationship between the two + symbols, but given that aliases virtually always exist for a reason, + it doesn't seem worthwhile. */ + if (flag_unit_at_a_time) + { + struct cgraph_node *fnode = NULL; + struct cgraph_varpool_node *vnode = NULL; + + if (TREE_CODE (decl) == FUNCTION_DECL) + { + fnode = cgraph_node_for_asm (target); + if (fnode != NULL) + cgraph_mark_needed_node (fnode); + else + { + vnode = cgraph_varpool_node_for_asm (target); + if (vnode != NULL) + cgraph_varpool_mark_needed_node (vnode); + } + } + else + { + vnode = cgraph_varpool_node_for_asm (target); + if (vnode != NULL) + cgraph_varpool_mark_needed_node (vnode); + else + { + fnode = cgraph_node_for_asm (target); + if (fnode != NULL) + cgraph_mark_needed_node (fnode); + } + } + + if (fnode == NULL && vnode == NULL) + warning ("%qD aliased to undefined symbol %qE", decl, target); + } + TREE_USED (decl) = 1; TREE_ASM_WRITTEN (decl) = 1; TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)) = 1; |