From: rth Date: Sun, 3 Mar 2002 04:50:53 +0000 (+0000) Subject: * attribs.c (handle_alias_attribute): Don't call assemble_alias. X-Git-Tag: upstream/4.9.2~88345 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01694f08f0f243e25e2fe4f288d963bdaaed2c00;p=platform%2Fupstream%2Flinaro-gcc.git * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50237 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85872bb..410c2cf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2002-03-02 Richard Henderson + * 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. + +2002-03-02 Richard Henderson + * varasm.c (make_decl_rtl): Remove call to REDO_SECTION_INFO_P; invoke ENCODE_SECTION_INFO with first call flag. diff --git a/gcc/attribs.c b/gcc/attribs.c index 2879d10..ca5a10c 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -1054,7 +1054,6 @@ handle_alias_attribute (node, name, args, flags, no_add_attrs) DECL_INITIAL (decl) = error_mark_node; else DECL_EXTERNAL (decl) = 0; - assemble_alias (decl, id); } else { @@ -1102,8 +1101,6 @@ handle_visibility_attribute (node, name, args, flags, no_add_attrs) *no_add_attrs = true; return NULL_TREE; } - - assemble_visibility (decl, TREE_STRING_POINTER (id)); } return NULL_TREE; diff --git a/gcc/toplev.c b/gcc/toplev.c index 7460582..1767fb4 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2254,17 +2254,33 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end) #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END) #endif + /* We deferred calling assemble_alias so that we could collect + other attributes such as visibility. Emit the alias now. */ + { + tree alias; + alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl)); + if (alias) + { + alias = TREE_VALUE (TREE_VALUE (alias)); + alias = get_identifier (TREE_STRING_POINTER (alias)); + assemble_alias (decl, alias); + } + } + /* Forward declarations for nested functions are not "external", but we need to treat them as if they were. */ if (TREE_STATIC (decl) || DECL_EXTERNAL (decl) || TREE_CODE (decl) == FUNCTION_DECL) { timevar_push (TV_VARCONST); - if (asmspec) - make_decl_rtl (decl, asmspec); - /* Don't output anything - when a tentative file-scope definition is seen. - But at end of compilation, do output code for them. */ + + /* If asmspec non-zero, we may be creating a global register variable. + If asmspec zero, we may be making sure that ENCODE_SECTION_INFO is + up-to-date. */ + make_decl_rtl (decl, asmspec); + + /* Don't output anything when a tentative file-scope definition + is seen. But at end of compilation, do output code for them. */ if (at_end || !DECL_DEFER_OUTPUT (decl)) assemble_variable (decl, top_level, at_end, 0); if (decl == last_assemble_variable_decl) @@ -2272,6 +2288,7 @@ rest_of_decl_compilation (decl, asmspec, top_level, at_end) ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl, top_level, at_end); } + timevar_pop (TV_VARCONST); } else if (DECL_REGISTER (decl) && asmspec != 0) 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