Commit 810db579 by Jan Hubicka Committed by Jan Hubicka

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
parent fc4fe9e4
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> 2003-08-19 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.c (mips_va_arg): If EABI_FLOAT_VARARGS_P, * config/mips/mips.c (mips_va_arg): If EABI_FLOAT_VARARGS_P,
......
...@@ -248,6 +248,7 @@ cgraph_mark_needed_node (struct cgraph_node *node, int needed) ...@@ -248,6 +248,7 @@ cgraph_mark_needed_node (struct cgraph_node *node, int needed)
node->next_needed = cgraph_nodes_queue; node->next_needed = cgraph_nodes_queue;
cgraph_nodes_queue = node; cgraph_nodes_queue = node;
notice_global_symbol (node->decl);
/* At the moment frontend automatically emits all nested functions. */ /* At the moment frontend automatically emits all nested functions. */
if (node->nested) if (node->nested)
...@@ -465,6 +466,7 @@ cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *node) ...@@ -465,6 +466,7 @@ cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *node)
{ {
node->next_needed = cgraph_varpool_nodes_queue; node->next_needed = cgraph_varpool_nodes_queue;
cgraph_varpool_nodes_queue = node; cgraph_varpool_nodes_queue = node;
notice_global_symbol (node->decl);
} }
node->needed = 1; node->needed = 1;
} }
......
...@@ -2944,6 +2944,7 @@ enum tls_model decl_tls_model (tree); ...@@ -2944,6 +2944,7 @@ enum tls_model decl_tls_model (tree);
enum symbol_visibility decl_visibility (tree); enum symbol_visibility decl_visibility (tree);
extern void resolve_unique_section (tree, int, int); extern void resolve_unique_section (tree, int, int);
extern void mark_referenced (tree); extern void mark_referenced (tree);
extern void notice_global_symbol (tree);
/* In stmt.c */ /* In stmt.c */
extern void emit_nop (void); extern void emit_nop (void);
......
...@@ -1040,6 +1040,34 @@ default_ctor_section_asm_out_constructor (rtx symbol, ...@@ -1040,6 +1040,34 @@ default_ctor_section_asm_out_constructor (rtx symbol,
#define CONSTANT_POOL_BEFORE_FUNCTION 1 #define CONSTANT_POOL_BEFORE_FUNCTION 1
#endif #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 /* Output assembler code for the constant pool of a function and associated
with defining the name of the function. DECL describes the function. 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 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) ...@@ -1093,19 +1121,7 @@ assemble_start_function (tree decl, const char *fnname)
if (TREE_PUBLIC (decl)) if (TREE_PUBLIC (decl))
{ {
if (! first_global_object_name) notice_global_symbol (decl);
{
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;
}
globalize_decl (decl); globalize_decl (decl);
...@@ -1400,20 +1416,8 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, ...@@ -1400,20 +1416,8 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED,
} }
name = XSTR (XEXP (decl_rtl, 0), 0); name = XSTR (XEXP (decl_rtl, 0), 0);
if (TREE_PUBLIC (decl) && DECL_NAME (decl) if (TREE_PUBLIC (decl) && DECL_NAME (decl))
&& ! first_global_object_name notice_global_symbol (decl);
&& ! (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;
}
/* Compute the alignment of this data. */ /* Compute the alignment of this data. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment