(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
2002-03-02 Richard Henderson <rth@redhat.com>
+ * 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 <rth@redhat.com>
+
* varasm.c (make_decl_rtl): Remove call to REDO_SECTION_INFO_P;
invoke ENCODE_SECTION_INFO with first call flag.
DECL_INITIAL (decl) = error_mark_node;
else
DECL_EXTERNAL (decl) = 0;
- assemble_alias (decl, id);
}
else
{
*no_add_attrs = true;
return NULL_TREE;
}
-
- assemble_visibility (decl, TREE_STRING_POINTER (id));
}
return NULL_TREE;
#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)
ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
top_level, at_end);
}
+
timevar_pop (TV_VARCONST);
}
else if (DECL_REGISTER (decl) && asmspec != 0)
#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
else
#endif
ASM_GLOBALIZE_LABEL (asm_out_file, fnname);
+
+ maybe_assemble_visibility (decl);
}
/* Do any machine/system dependent processing of the function name */
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
else
#endif
ASM_GLOBALIZE_LABEL (asm_out_file, name);
+
+ maybe_assemble_visibility (decl);
}
#ifdef ASM_OUTPUT_DEF_FROM_DECLS
#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