From 810db5799bdd7df6026bae4232b9e5d4352e394e Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 19 Aug 2003 09:37:07 +0200 Subject: [PATCH] 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 --- gcc/ChangeLog | 9 ++++++++ gcc/cgraph.c | 2 ++ gcc/tree.h | 1 + gcc/varasm.c | 58 +++++++++++++++++++++++++++------------------------ 4 files changed, 43 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e82dbad3a4..0d685771e53 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2003-08-19 Jan Hubicka + + * 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 * config/mips/mips.c (mips_va_arg): If EABI_FLOAT_VARARGS_P, diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 9aa12a6102d..bd83f6a1946 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 69e75e1af36..dbf8c8f86f2 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 512bc33ba89..ac535212056 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. */ -- 2.30.2