aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>2010-10-11 16:52:12 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2010-10-11 16:52:12 +0000
commit74b90fe2a00d558380d9ae40a309a7b97dc3bdb5 (patch)
tree591e6322718efbd38a18ee5189259cb088b8b372 /gcc
parent2861cfa1eb2f58ba3b9d987e552b0d34ed9fa9c6 (diff)
downloadgcc-74b90fe2a00d558380d9ae40a309a7b97dc3bdb5.zip
gcc-74b90fe2a00d558380d9ae40a309a7b97dc3bdb5.tar.gz
gcc-74b90fe2a00d558380d9ae40a309a7b97dc3bdb5.tar.bz2
re PR middle-end/45862 (SUPPORTS_WEAK is documented as a C expression, used as a compile time constant)
PR middle-end/45862 * doc/tm.texi.in (SUPPORTS_WEAK): Update. (TARGET_SUPPORTS_WEAK): New. * doc/tm.texi: Regenerate. * defaults.h (SUPPORTS_WEAK): Update comment. (TARGET_SUPPORTS_WEAK): New. * dwarf2asm.c (USE_LINKONCE_INDIRECT): Update define. * varasm.c (assemble_external): Use TARGET_SUPPORTS_WEAK instead of SUPPORTS_WEAK. (merge_weak, declare_weak, do_assemble_alias, supports_one_only, make_decl_one_only): Likewise. * config/pa/som.h (SUPPORTS_WEAK): Rename defines to TARGET_SUPPORTS_WEAK. (SUPPORTS_ONE_ONLY, MAKE_DECL_ONE_ONLY): Use TARGET_SUPPORTS_WEAK instead of SUPPORTS_WEAK. From-SVN: r165319
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/config/pa/som.h12
-rw-r--r--gcc/defaults.h9
-rw-r--r--gcc/doc/tm.texi16
-rw-r--r--gcc/doc/tm.texi.in16
-rw-r--r--gcc/dwarf2asm.c4
-rw-r--r--gcc/varasm.c14
7 files changed, 66 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63564aa..0a6120c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+2010-10-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR middle-end/45862
+ * doc/tm.texi.in (SUPPORTS_WEAK): Update.
+ (TARGET_SUPPORTS_WEAK): New.
+ * doc/tm.texi: Regenerate.
+ * defaults.h (SUPPORTS_WEAK): Update comment.
+ (TARGET_SUPPORTS_WEAK): New.
+ * dwarf2asm.c (USE_LINKONCE_INDIRECT): Update define.
+ * varasm.c (assemble_external): Use TARGET_SUPPORTS_WEAK instead of
+ SUPPORTS_WEAK.
+ (merge_weak, declare_weak, do_assemble_alias, supports_one_only,
+ make_decl_one_only): Likewise.
+ * config/pa/som.h (SUPPORTS_WEAK): Rename defines to
+ TARGET_SUPPORTS_WEAK.
+ (SUPPORTS_ONE_ONLY, MAKE_DECL_ONE_ONLY): Use TARGET_SUPPORTS_WEAK
+ instead of SUPPORTS_WEAK.
+
2010-10-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/sparc/gmon-sol2.c: Don't include coretypes.h, tm.h.
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index 53dddb7..c8f77d4 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -272,11 +272,13 @@ do { \
#define ALWAYS_STRIP_DOTDOT 1
/* If GAS supports weak, we can support weak when we have working linker
- support for secondary definitions and are generating code for GAS. */
+ support for secondary definitions and are generating code for GAS.
+ This is primarily for one-only support as SOM doesn't allow undefined
+ weak symbols. */
#ifdef HAVE_GAS_WEAK
-#define SUPPORTS_WEAK (TARGET_SOM_SDEF && TARGET_GAS)
+#define TARGET_SUPPORTS_WEAK (TARGET_SOM_SDEF && TARGET_GAS)
#else
-#define SUPPORTS_WEAK 0
+#define TARGET_SUPPORTS_WEAK 0
#endif
/* CVS GAS as of 4/28/04 supports a comdat parameter for the .nsubspa
@@ -289,7 +291,7 @@ do { \
#endif
/* We can support one only if we support weak or comdat. */
-#define SUPPORTS_ONE_ONLY (SUPPORTS_WEAK || SUPPORTS_SOM_COMDAT)
+#define SUPPORTS_ONE_ONLY (TARGET_SUPPORTS_WEAK || SUPPORTS_SOM_COMDAT)
/* We use DECL_COMMON for uninitialized one-only variables as we don't
have linkonce .bss. We use SOM secondary definitions or comdat for
@@ -300,7 +302,7 @@ do { \
&& (DECL_INITIAL (DECL) == 0 \
|| DECL_INITIAL (DECL) == error_mark_node)) \
DECL_COMMON (DECL) = 1; \
- else if (SUPPORTS_WEAK) \
+ else if (TARGET_SUPPORTS_WEAK) \
DECL_WEAK (DECL) = 1; \
} while (0)
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 6ecebb6..8858572 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -286,7 +286,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
#endif
-/* This determines whether or not we support weak symbols. */
+/* This determines whether or not we support weak symbols. SUPPORTS_WEAK
+ must be a preprocessor constant. */
#ifndef SUPPORTS_WEAK
#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
#define SUPPORTS_WEAK 1
@@ -295,6 +296,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
#endif
+/* This determines whether or not we support weak symbols during target
+ code generation. TARGET_SUPPORTS_WEAK can be any valid C expression. */
+#ifndef TARGET_SUPPORTS_WEAK
+#define TARGET_SUPPORTS_WEAK (SUPPORTS_WEAK)
+#endif
+
/* This determines whether or not we support the discriminator
attribute in the .loc directive. */
#ifndef SUPPORTS_DISCRIMINATOR
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index f98176a..298b3b9 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -7923,13 +7923,21 @@ declaration of @code{name}.
@end defmac
@defmac SUPPORTS_WEAK
-A C expression which evaluates to true if the target supports weak symbols.
+A preprocessor constant expression which evaluates to true if the target
+supports weak symbols.
If you don't define this macro, @file{defaults.h} provides a default
definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL}
-is defined, the default definition is @samp{1}; otherwise, it is
-@samp{0}. Define this macro if you want to control weak symbol support
-with a compiler flag such as @option{-melf}.
+is defined, the default definition is @samp{1}; otherwise, it is @samp{0}.
+@end defmac
+
+@defmac TARGET_SUPPORTS_WEAK
+A C expression which evaluates to true if the target supports weak symbols.
+
+If you don't define this macro, @file{defaults.h} provides a default
+definition. The default definition is @samp{(SUPPORTS_WEAK)}. Define
+this macro if you want to control weak symbol support with a compiler
+flag such as @option{-melf}.
@end defmac
@defmac MAKE_DECL_ONE_ONLY (@var{decl})
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 41d5aee..c97b514 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7909,13 +7909,21 @@ declaration of @code{name}.
@end defmac
@defmac SUPPORTS_WEAK
-A C expression which evaluates to true if the target supports weak symbols.
+A preprocessor constant expression which evaluates to true if the target
+supports weak symbols.
If you don't define this macro, @file{defaults.h} provides a default
definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL}
-is defined, the default definition is @samp{1}; otherwise, it is
-@samp{0}. Define this macro if you want to control weak symbol support
-with a compiler flag such as @option{-melf}.
+is defined, the default definition is @samp{1}; otherwise, it is @samp{0}.
+@end defmac
+
+@defmac TARGET_SUPPORTS_WEAK
+A C expression which evaluates to true if the target supports weak symbols.
+
+If you don't define this macro, @file{defaults.h} provides a default
+definition. The default definition is @samp{(SUPPORTS_WEAK)}. Define
+this macro if you want to control weak symbol support with a compiler
+flag such as @option{-melf}.
@end defmac
@defmac MAKE_DECL_ONE_ONLY (@var{decl})
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 84e8cad..eefc29f 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -798,8 +798,8 @@ static GTY((param1_is (char *), param2_is (tree))) splay_tree indirect_pool;
static GTY(()) int dw2_const_labelno;
-#if defined(HAVE_GAS_HIDDEN) && defined(SUPPORTS_ONE_ONLY)
-# define USE_LINKONCE_INDIRECT 1
+#if defined(HAVE_GAS_HIDDEN)
+# define USE_LINKONCE_INDIRECT (SUPPORTS_ONE_ONLY)
#else
# define USE_LINKONCE_INDIRECT 0
#endif
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 4381571..03e25dd 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2053,7 +2053,7 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
/* We want to output annotation for weak and external symbols at
very last to check if they are references or not. */
- if (SUPPORTS_WEAK
+ if (TARGET_SUPPORTS_WEAK
&& DECL_WEAK (decl)
/* TREE_STATIC is a weird and abused creature which is not
generally the right test for whether an entity has been
@@ -5027,7 +5027,7 @@ merge_weak (tree newdecl, tree olddecl)
{
if (DECL_WEAK (newdecl) == DECL_WEAK (olddecl))
{
- if (DECL_WEAK (newdecl) && SUPPORTS_WEAK)
+ if (DECL_WEAK (newdecl) && TARGET_SUPPORTS_WEAK)
{
tree *pwd;
/* We put the NEWDECL on the weak_decls list at some point
@@ -5064,7 +5064,7 @@ merge_weak (tree newdecl, tree olddecl)
warning (0, "weak declaration of %q+D after first use results "
"in unspecified behavior", newdecl);
- if (SUPPORTS_WEAK)
+ if (TARGET_SUPPORTS_WEAK)
{
/* We put the NEWDECL on the weak_decls list at some point.
Replace it with the OLDDECL. */
@@ -5098,7 +5098,7 @@ declare_weak (tree decl)
error ("weak declaration of %q+D must be public", decl);
else if (TREE_CODE (decl) == FUNCTION_DECL && TREE_ASM_WRITTEN (decl))
error ("weak declaration of %q+D must precede definition", decl);
- else if (!SUPPORTS_WEAK)
+ else if (!TARGET_SUPPORTS_WEAK)
warning (0, "weak declaration of %q+D not supported", decl);
mark_weak (decl);
@@ -5344,7 +5344,7 @@ do_assemble_alias (tree decl, tree target)
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
IDENTIFIER_POINTER (target));
#else
- if (!SUPPORTS_WEAK)
+ if (!TARGET_SUPPORTS_WEAK)
{
error_at (DECL_SOURCE_LOCATION (decl),
"weakref is not supported in this configuration");
@@ -5636,7 +5636,7 @@ supports_one_only (void)
{
if (SUPPORTS_ONE_ONLY)
return 1;
- return SUPPORTS_WEAK;
+ return TARGET_SUPPORTS_WEAK;
}
/* Set up DECL as a public symbol that can be defined in multiple
@@ -5662,7 +5662,7 @@ make_decl_one_only (tree decl, tree comdat_group)
DECL_COMMON (decl) = 1;
else
{
- gcc_assert (SUPPORTS_WEAK);
+ gcc_assert (TARGET_SUPPORTS_WEAK);
DECL_WEAK (decl) = 1;
}
}