summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-19 07:37:07 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-19 07:37:07 +0000
commit3cad5dd7c1fee7fbee969bb9ad9983c7733215db (patch)
treeff4fc2d7d933acd56aa7e5c666a1d035934cce47 /gcc/varasm.c
parentd29dda0fb33b94041e5c7268c3e01da10d2e6142 (diff)
downloadgcc-3cad5dd7c1fee7fbee969bb9ad9983c7733215db.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70559 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c58
1 files changed, 31 insertions, 27 deletions
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. */