summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-01-06 19:52:25 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-01-06 19:52:25 +0000
commit846245f5829a18cd743d0d6f00b53fb01d98380c (patch)
tree74b6dcc92e2f6e4a2029755502a01afdf290c9d0
parent298d4ace4f732196371314fca52f5fedd4d8cdaa (diff)
Make gcc(1) really ignore __attribute__((visibility)) if HAVE_GAS_HIDDEN isn't
defined. ok miod@
-rw-r--r--gnu/usr.bin/gcc/gcc/varasm.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/gnu/usr.bin/gcc/gcc/varasm.c b/gnu/usr.bin/gcc/gcc/varasm.c
index 9a760998f62..4d1a3374695 100644
--- a/gnu/usr.bin/gcc/gcc/varasm.c
+++ b/gnu/usr.bin/gcc/gcc/varasm.c
@@ -1,6 +1,6 @@
/* Output variables, constants and external declarations, for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -4673,14 +4673,26 @@ assemble_alias (decl, target)
#endif
#else /* !ASM_OUTPUT_DEF */
#if defined (ASM_OUTPUT_WEAK_ALIAS) || defined (ASM_WEAKEN_DECL)
- if (! DECL_WEAK (decl))
- warning ("only weak aliases are supported in this configuration");
-
+ if (DECL_WEAK (decl))
+ {
+ tree *p, t;
#ifdef ASM_WEAKEN_DECL
- ASM_WEAKEN_DECL (asm_out_file, decl, name, IDENTIFIER_POINTER (target));
+ ASM_WEAKEN_DECL (asm_out_file, decl, name, IDENTIFIER_POINTER (target));
#else
- ASM_OUTPUT_WEAK_ALIAS (asm_out_file, name, IDENTIFIER_POINTER (target));
+ ASM_OUTPUT_WEAK_ALIAS (asm_out_file, name, IDENTIFIER_POINTER (target));
#endif
+ /* Remove this function from the pending weak list so that
+ we do not emit multiple .weak directives for it. */
+ for (p = &weak_decls; (t = *p) ; )
+ if (DECL_ASSEMBLER_NAME (decl)
+ == DECL_ASSEMBLER_NAME (TREE_VALUE (t)))
+ *p = TREE_CHAIN (t);
+ else
+ p = &TREE_CHAIN (t);
+ }
+ else
+ warning ("only weak aliases are supported in this configuration");
+
#else
warning ("alias definitions not supported in this configuration; ignored");
#endif
@@ -4754,16 +4766,16 @@ make_decl_one_only (decl)
TREE_PUBLIC (decl) = 1;
- if (TREE_CODE (decl) == VAR_DECL
- && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
- DECL_COMMON (decl) = 1;
- else if (SUPPORTS_ONE_ONLY)
+ if (SUPPORTS_ONE_ONLY)
{
#ifdef MAKE_DECL_ONE_ONLY
MAKE_DECL_ONE_ONLY (decl);
#endif
DECL_ONE_ONLY (decl) = 1;
}
+ else if (TREE_CODE (decl) == VAR_DECL
+ && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
+ DECL_COMMON (decl) = 1;
else if (SUPPORTS_WEAK)
DECL_WEAK (decl) = 1;
else
@@ -4831,6 +4843,7 @@ enum symbol_visibility
decl_visibility (decl)
tree decl;
{
+#ifdef HAVE_GAS_HIDDEN
tree attr = lookup_attribute ("visibility", DECL_ATTRIBUTES (decl));
if (attr)
@@ -4848,6 +4861,7 @@ decl_visibility (decl)
abort ();
}
+#endif
return VISIBILITY_DEFAULT;
}