diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8bd58417d6..2ee542cae72 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2002-03-13 Jason Merrill + + * 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 * config/cris/cris.c (cris_target_asm_function_prologue): Revert 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); }