diff options
author | Richard Henderson <rth@redhat.com> | 2005-01-01 23:52:31 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-01-01 23:52:31 -0800 |
commit | bedb9fc04bb56b56d8af671bdfe28cc9052622ec (patch) | |
tree | 9fcf4185c5360e802ff2cef25c68d1cd2b7178d6 /gcc/cgraph.c | |
parent | 1cb2fc7b18423a905d0c646dc7b0b6b5a023de36 (diff) | |
download | gcc-bedb9fc04bb56b56d8af671bdfe28cc9052622ec.zip gcc-bedb9fc04bb56b56d8af671bdfe28cc9052622ec.tar.gz gcc-bedb9fc04bb56b56d8af671bdfe28cc9052622ec.tar.bz2 |
re PR c/19031 (#pragma weak handling changes in 4.0.0)
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.
From-SVN: r92803
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 8a570b3..1c06616 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) |