varasm.c (globalize_decl): New fn.

* varasm.c (globalize_decl): New fn.
        (assemble_start_function): Use it.
        (asm_emit_uninitialized): Use it.
        (assemble_alias): Use it.
        (assemble_variable): Use it.

From-SVN: r50736
This commit is contained in:
Jason Merrill 2002-03-13 09:20:17 -05:00 committed by Jason Merrill
parent 2a15f5e1e2
commit 19c5b1cf0d
2 changed files with 39 additions and 50 deletions

View File

@ -1,3 +1,11 @@
2002-03-13 Jason Merrill <jason@redhat.com>
* varasm.c (globalize_decl): New fn.
(assemble_start_function): Use it.
(asm_emit_uninitialized): Use it.
(assemble_alias): Use it.
(assemble_variable): Use it.
2002-03-13 Hans-Peter Nilsson <hp@axis.com>
* config/cris/cris.c (cris_target_asm_function_prologue): Revert

View File

@ -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);
}