aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-08-19 09:37:07 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2003-08-19 07:37:07 +0000
commit810db5799bdd7df6026bae4232b9e5d4352e394e (patch)
treeff4fc2d7d933acd56aa7e5c666a1d035934cce47
parentfc4fe9e434a4a652065cff0e5380d9446debf32a (diff)
downloadgcc-810db5799bdd7df6026bae4232b9e5d4352e394e.zip
gcc-810db5799bdd7df6026bae4232b9e5d4352e394e.tar.gz
gcc-810db5799bdd7df6026bae4232b9e5d4352e394e.tar.bz2
cgraph.c (cgraph_mark_needed_node): Call notice_global_symbol.
* cgraph.c (cgraph_mark_needed_node): Call notice_global_symbol. (cgraph_varpool_mark_needed_node): Likewise. * cgraph.h (notice_global_symbol): Declare * varasm.c (notice_global_symbol): Break out from ... (assemble_start_function): ... here; update for variables. (assemble_variable): Use notice_global_symbol. From-SVN: r70559
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cgraph.c2
-rw-r--r--gcc/tree.h1
-rw-r--r--gcc/varasm.c58
4 files changed, 43 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4e82dba..0d68577 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2003-08-19 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_mark_needed_node): Call notice_global_symbol.
+ (cgraph_varpool_mark_needed_node): Likewise.
+ * cgraph.h (notice_global_symbol): Declare
+ * varasm.c (notice_global_symbol): Break out from ...
+ (assemble_start_function): ... here; update for variables.
+ (assemble_variable): Use notice_global_symbol.
+
2003-08-19 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.c (mips_va_arg): If EABI_FLOAT_VARARGS_P,
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 9aa12a6..bd83f6a 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -248,6 +248,7 @@ cgraph_mark_needed_node (struct cgraph_node *node, int needed)
node->next_needed = cgraph_nodes_queue;
cgraph_nodes_queue = node;
+ notice_global_symbol (node->decl);
/* At the moment frontend automatically emits all nested functions. */
if (node->nested)
@@ -465,6 +466,7 @@ cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *node)
{
node->next_needed = cgraph_varpool_nodes_queue;
cgraph_varpool_nodes_queue = node;
+ notice_global_symbol (node->decl);
}
node->needed = 1;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index 69e75e1..dbf8c8f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2944,6 +2944,7 @@ enum tls_model decl_tls_model (tree);
enum symbol_visibility decl_visibility (tree);
extern void resolve_unique_section (tree, int, int);
extern void mark_referenced (tree);
+extern void notice_global_symbol (tree);
/* In stmt.c */
extern void emit_nop (void);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 512bc33..ac53521 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1040,6 +1040,34 @@ default_ctor_section_asm_out_constructor (rtx symbol,
#define CONSTANT_POOL_BEFORE_FUNCTION 1
#endif
+/* DECL is an object (either VAR_DECL or FUNCTION_DECL) which is going
+ to be output to assembler.
+ Set first_global_object_name and weak_global_object_name as appropriate. */
+
+void
+notice_global_symbol (tree decl)
+{
+ if ((!first_global_object_name || !weak_global_object_name)
+ && TREE_PUBLIC (decl)
+ && (TREE_CODE (decl) == FUNCTION_DECL
+ || ! (DECL_COMMON (decl)
+ && (DECL_INITIAL (decl) == 0
+ || DECL_INITIAL (decl) == error_mark_node))))
+ {
+ const char *p;
+ char *name;
+ rtx decl_rtl = DECL_RTL (decl);
+
+ p = (* targetm.strip_name_encoding) (XSTR (XEXP (decl_rtl, 0), 0));
+ name = xstrdup (p);
+
+ if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
+ first_global_object_name = name;
+ else
+ weak_global_object_name = name;
+ }
+}
+
/* Output assembler code for the constant pool of a function and associated
with defining the name of the function. DECL describes the function.
NAME is the function's name. For the constant pool, we use the current
@@ -1093,19 +1121,7 @@ assemble_start_function (tree decl, const char *fnname)
if (TREE_PUBLIC (decl))
{
- if (! first_global_object_name)
- {
- const char *p;
- char *name;
-
- p = (* targetm.strip_name_encoding) (fnname);
- name = xstrdup (p);
-
- if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
- first_global_object_name = name;
- else
- weak_global_object_name = name;
- }
+ notice_global_symbol (decl);
globalize_decl (decl);
@@ -1400,20 +1416,8 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
}
name = XSTR (XEXP (decl_rtl, 0), 0);
- if (TREE_PUBLIC (decl) && DECL_NAME (decl)
- && ! first_global_object_name
- && ! (DECL_COMMON (decl) && (DECL_INITIAL (decl) == 0
- || DECL_INITIAL (decl) == error_mark_node))
- && ! DECL_WEAK (decl)
- && ! DECL_ONE_ONLY (decl))
- {
- const char *p;
- char *xname;
-
- p = (* targetm.strip_name_encoding) (name);
- xname = xstrdup (p);
- first_global_object_name = xname;
- }
+ if (TREE_PUBLIC (decl) && DECL_NAME (decl))
+ notice_global_symbol (decl);
/* Compute the alignment of this data. */