diff options
author | Richard Henderson <rth@redhat.com> | 2005-01-02 07:52:31 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2005-01-02 07:52:31 +0000 |
commit | 0c0c27bb070eb153d1660f7304696a9053fc3ae5 (patch) | |
tree | 9fcf4185c5360e802ff2cef25c68d1cd2b7178d6 /gcc/cgraph.c | |
parent | 7349c08afaa905bcc2a9c7942d3758335c599ba8 (diff) |
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: https://gcc.gnu.org/svn/gcc/trunk@92803 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 8a570b394a1..1c066162149 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -194,6 +194,56 @@ cgraph_node (tree decl) return node; } +/* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */ + +static bool +decl_assembler_name_equal (tree decl, tree asmname) +{ + tree decl_asmname = DECL_ASSEMBLER_NAME (decl); + + if (decl_asmname == asmname) + return true; + + /* If the target assembler name was set by the user, things are trickier. + We have a leading '*' to begin with. After that, it's arguable what + is the correct thing to do with -fleading-underscore. Arguably, we've + historically been doing the wrong thing in assemble_alias by always + printing the leading underscore. Since we're not changing that, make + sure user_label_prefix follows the '*' before matching. */ + if (IDENTIFIER_POINTER (decl_asmname)[0] == '*') + { + const char *decl_str = IDENTIFIER_POINTER (decl_asmname) + 1; + size_t ulp_len = strlen (user_label_prefix); + + if (ulp_len == 0) + ; + else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0) + decl_str += ulp_len; + else + return false; + + return strcmp (decl_str, IDENTIFIER_POINTER (asmname)) == 0; + } + + return false; +} + + +/* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME. + Return NULL if there's no such node. */ + +struct cgraph_node * +cgraph_node_for_asm (tree asmname) +{ + struct cgraph_node *node; + + for (node = cgraph_nodes; node ; node = node->next) + if (decl_assembler_name_equal (node->decl, asmname)) + return node; + + return NULL; +} + /* Return callgraph edge representing CALL_EXPR. */ struct cgraph_edge * cgraph_edge (struct cgraph_node *node, tree call_expr) @@ -533,12 +583,25 @@ cgraph_varpool_node (tree decl) return *slot; node = ggc_alloc_cleared (sizeof (*node)); node->decl = decl; + node->next = cgraph_varpool_nodes; cgraph_varpool_n_nodes++; cgraph_varpool_nodes = node; *slot = node; return node; } +struct cgraph_varpool_node * +cgraph_varpool_node_for_asm (tree asmname) +{ + struct cgraph_varpool_node *node; + + for (node = cgraph_varpool_nodes; node ; node = node->next) + if (decl_assembler_name_equal (node->decl, asmname)) + return node; + + return NULL; +} + /* Set the DECL_ASSEMBLER_NAME and update cgraph hashtables. */ void change_decl_assembler_name (tree decl, tree name) |