+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,
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)
{
node->next_needed = cgraph_varpool_nodes_queue;
cgraph_varpool_nodes_queue = node;
+ notice_global_symbol (node->decl);
}
node->needed = 1;
}
#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
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);
}
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. */