From b14707c32c79de908de45735e2c5f17e89776563 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 2 Mar 2002 20:50:53 -0800 Subject: attribs.c (handle_alias_attribute): Don't call assemble_alias. * attribs.c (handle_alias_attribute): Don't call assemble_alias. (handle_visibility_attribute): Don't call assemble_visibility. * toplev.c (rest_of_decl_compilation): Invoke make_decl_rtl even without asmspec. Invoke assemble_alias when needed. * varasm.c (maybe_assemble_visibility): New. (assemble_start_function, assemble_variable, assemble_alias): Use it. From-SVN: r50237 --- gcc/varasm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gcc/varasm.c') diff --git a/gcc/varasm.c b/gcc/varasm.c index 4d57b89..187429e 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 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)); #ifdef ASM_OUTPUT_BSS @@ -1252,6 +1253,8 @@ assemble_start_function (decl, fnname) else #endif ASM_GLOBALIZE_LABEL (asm_out_file, fnname); + + maybe_assemble_visibility (decl); } /* Do any machine/system dependent processing of the function name */ @@ -1603,6 +1606,9 @@ assemble_variable (decl, top_level, at_end, dont_output_data) DECL_ALIGN (decl) = align; set_mem_align (decl_rtl, align); + if (TREE_PUBLIC (decl)) + maybe_assemble_visibility (decl); + /* Handle uninitialized definitions. */ if ((DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node @@ -5181,6 +5187,8 @@ assemble_alias (decl, target) else #endif ASM_GLOBALIZE_LABEL (asm_out_file, name); + + maybe_assemble_visibility (decl); } #ifdef ASM_OUTPUT_DEF_FROM_DECLS @@ -5225,6 +5233,21 @@ assemble_visibility (decl, visibility_type) #endif } +/* A helper function to call assemble_visibility when needed for a decl. */ + +static void +maybe_assemble_visibility (decl) + tree decl; +{ + tree visibility = lookup_attribute ("visibility", DECL_ATTRIBUTES (decl)); + if (visibility) + { + const char *type + = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (visibility))); + assemble_visibility (decl, type); + } +} + /* Returns 1 if the target configuration supports defining public symbols so that one of them will be chosen at link time instead of generating a multiply-defined symbol error, whether through the use of weak symbols or -- cgit v1.1