summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-13 14:20:17 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-13 14:20:17 +0000
commit1fbd58a2cf69be093eef20596d7c244261fde891 (patch)
treeb9254ce674c129b502ae8d4ae9716875be953aa5 /gcc/varasm.c
parent082203db8f90cb62d4b1e4a8ae633812b9c4af41 (diff)
downloadgcc-1fbd58a2cf69be093eef20596d7c244261fde891.tar.gz
* varasm.c (globalize_decl): New fn.
(assemble_start_function): Use it. (asm_emit_uninitialized): Use it. (assemble_alias): Use it. (assemble_variable): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50736 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c81
1 files changed, 31 insertions, 50 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 187429eb512..5d41f638ab1 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -171,6 +171,7 @@ static void mark_weak_decls PARAMS ((void *));
#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
static void remove_from_pending_weak_list PARAMS ((const char *));
#endif
+static void globalize_decl PARAMS ((tree));
static void maybe_assemble_visibility PARAMS ((tree));
static int in_named_entry_eq PARAMS ((const PTR, const PTR));
static hashval_t in_named_entry_hash PARAMS ((const PTR));
@@ -1237,22 +1238,7 @@ assemble_start_function (decl, fnname)
weak_global_object_name = name;
}
-#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
- if (DECL_WEAK (decl))
- {
-#ifdef ASM_WEAKEN_DECL
- ASM_WEAKEN_DECL (asm_out_file, decl, fnname, 0);
-#else
- ASM_WEAKEN_LABEL (asm_out_file, fnname);
-#endif
- /* Remove this function from the pending weak list so that
- we do not emit multiple .weak directives for it. */
- remove_from_pending_weak_list
- (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- }
- else
-#endif
- ASM_GLOBALIZE_LABEL (asm_out_file, fnname);
+ globalize_decl (decl);
maybe_assemble_visibility (decl);
}
@@ -1443,6 +1429,7 @@ asm_emit_uninitialised (decl, name, size, rounded)
{
#ifdef ASM_EMIT_BSS
case asm_dest_bss:
+ globalize_decl (decl);
ASM_EMIT_BSS (decl, name, size, rounded);
break;
#endif
@@ -1657,24 +1644,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
/* First make the assembler name(s) global if appropriate. */
if (TREE_PUBLIC (decl) && DECL_NAME (decl))
- {
-#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
- if (DECL_WEAK (decl))
- {
-#ifdef ASM_WEAKEN_DECL
- ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
-#else
- ASM_WEAKEN_LABEL (asm_out_file, name);
-#endif
- /* Remove this variable from the pending weak list so that
- we do not emit multiple .weak directives for it. */
- remove_from_pending_weak_list
- (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- }
- else
-#endif
- ASM_GLOBALIZE_LABEL (asm_out_file, name);
- }
+ globalize_decl (decl);
/* Output any data that we will need to use the address of. */
if (DECL_INITIAL (decl) == error_mark_node)
@@ -5151,6 +5121,32 @@ remove_from_pending_weak_list (name)
}
#endif /* defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL) */
+/* Emit the assembly bits to indicate that DECL is globally visible. */
+
+static void
+globalize_decl (decl)
+ tree decl;
+{
+ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+
+#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
+ if (DECL_WEAK (decl))
+ {
+#ifdef ASM_WEAKEN_DECL
+ ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
+#else
+ ASM_WEAKEN_LABEL (asm_out_file, name);
+#endif
+ /* Remove this function from the pending weak list so that
+ we do not emit multiple .weak directives for it. */
+ remove_from_pending_weak_list (name);
+ return;
+ }
+ /* else */
+#endif
+ ASM_GLOBALIZE_LABEL (asm_out_file, name);
+}
+
/* Emit an assembler directive to make the symbol for DECL an alias to
the symbol for TARGET. */
@@ -5171,22 +5167,7 @@ assemble_alias (decl, target)
if (TREE_PUBLIC (decl))
{
-#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
- if (DECL_WEAK (decl))
- {
-#ifdef ASM_WEAKEN_DECL
- ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
-#else
- ASM_WEAKEN_LABEL (asm_out_file, name);
-#endif
- /* Remove this function from the pending weak list so that
- we do not emit multiple .weak directives for it. */
- remove_from_pending_weak_list
- (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
- }
- else
-#endif
- ASM_GLOBALIZE_LABEL (asm_out_file, name);
+ globalize_decl (decl);
maybe_assemble_visibility (decl);
}