aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorRobert Lipe <robertlipe@usa.net>1999-06-07 19:46:39 +0000
committerJeff Law <law@gcc.gnu.org>1999-06-07 13:46:39 -0600
commitec99e58ffcdb080f1f5e69ee643b0ecd256f25b4 (patch)
tree0e7e6c1fa43f5727f16d2798892cafc440774f8f /gcc/varasm.c
parent729f8bf2231854123adf9485eca0765866a4b0c3 (diff)
downloadgcc-ec99e58ffcdb080f1f5e69ee643b0ecd256f25b4.zip
gcc-ec99e58ffcdb080f1f5e69ee643b0ecd256f25b4.tar.gz
gcc-ec99e58ffcdb080f1f5e69ee643b0ecd256f25b4.tar.bz2
varasm.c (assemble_start_function): Remove the function from the pending weak decls list when we define a function.
* varasm.c (assemble_start_function): Remove the function from the pending weak decls list when we define a function. (assemble_variable): Similarly for variables. (weak_finish): Ignore items on the list with a NULL name. (remove_from_ending_weak_list); New function to "remove" an item from the pending weak declarations list. Co-Authored-By: Jeffrey A Law <law@cygnus.com> From-SVN: r27402
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c56
1 files changed, 49 insertions, 7 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index c6f15b8..76f4058 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -141,6 +141,7 @@ static void mark_constants PROTO((rtx));
static int output_addressed_constants PROTO((tree));
static void output_after_function_constants PROTO((void));
static void output_constructor PROTO((tree, int));
+static void remove_from_pending_weak_list PROTO ((char *));
#ifdef ASM_OUTPUT_BSS
static void asm_output_bss PROTO((FILE *, tree, char *, int, int));
#endif
@@ -1012,7 +1013,13 @@ assemble_start_function (decl, fnname)
#ifdef ASM_WEAKEN_LABEL
if (DECL_WEAK (decl))
- ASM_WEAKEN_LABEL (asm_out_file, fnname);
+ {
+ ASM_WEAKEN_LABEL (asm_out_file, fnname);
+ /* 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);
@@ -1445,8 +1452,14 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
if (TREE_PUBLIC (decl) && DECL_NAME (decl))
{
#ifdef ASM_WEAKEN_LABEL
- if (DECL_WEAK (decl))
- ASM_WEAKEN_LABEL (asm_out_file, name);
+ if (DECL_WEAK (decl))
+ {
+ ASM_WEAKEN_LABEL (asm_out_file, name);
+ /* 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);
@@ -4351,9 +4364,32 @@ weak_finish ()
struct weak_syms *t;
for (t = weak_decls; t; t = t->next)
{
- ASM_WEAKEN_LABEL (asm_out_file, t->name);
- if (t->value)
- ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
+ if (t->name)
+ {
+ ASM_WEAKEN_LABEL (asm_out_file, t->name);
+ if (t->value)
+ ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
+ }
+ }
+ }
+#endif
+}
+
+/* Remove NAME from the pending list of weak symbols. This prevents
+ the compiler from emitting multiple .weak directives which confuses
+ some assemblers. */
+static void
+remove_from_pending_weak_list (name)
+ char *name;
+{
+#ifdef HANDLE_PRAGMA_WEAK
+ if (HANDLE_PRAGMA_WEAK)
+ {
+ struct weak_syms *t;
+ for (t = weak_decls; t; t = t->next)
+ {
+ if (strcmp (name, t->name) == 0)
+ t->name = NULL;
}
}
#endif
@@ -4375,7 +4411,13 @@ assemble_alias (decl, target)
{
#ifdef ASM_WEAKEN_LABEL
if (DECL_WEAK (decl))
- ASM_WEAKEN_LABEL (asm_out_file, name);
+ {
+ ASM_WEAKEN_LABEL (asm_out_file, name);
+ /* 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);