aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>2004-12-15 05:10:57 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2004-12-15 05:10:57 +0000
commite41f3691b90d1ff924c6d31530f60d7180f8f4e8 (patch)
treee8baa9d18aa0f3809f95d03f1a1736703aaf70e5
parent6b25a558d71af78b9c2891a761b441c4a4088285 (diff)
downloadgcc-e41f3691b90d1ff924c6d31530f60d7180f8f4e8.zip
gcc-e41f3691b90d1ff924c6d31530f60d7180f8f4e8.tar.gz
gcc-e41f3691b90d1ff924c6d31530f60d7180f8f4e8.tar.bz2
re PR c++/17242 (Testsuite fails due to duplicate symbols)
PR c++/17242 * configure.ac: Add GAS check for HP-UX .nsubspa comdat. * configure, config.in: Rebuilt. * config/pa/pa-hpux10.h (SUPPORTS_ONE_ONLY, MAKE_DECL_ONE_ONLY): Delete defines. * config/pa/pa.c (pa_select_section): Allow uninitialized variables in one-only (comdat) subspaces. * config/pa/som.h (SUPPORTS_SOM_COMDAT): New define. (SUPPORTS_ONE_ONLY): True if SUPPORTS_WEAK or SUPPORTS_SOM_COMDAT are true. (MAKE_DECL_ONE_ONLY): Place uninitialized variables in common. From-SVN: r92177
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config.in3
-rw-r--r--gcc/config/pa/pa-hpux10.h7
-rw-r--r--gcc/config/pa/pa.c3
-rw-r--r--gcc/config/pa/som.h27
-rwxr-xr-xgcc/configure38
-rw-r--r--gcc/configure.ac6
7 files changed, 85 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a6a4645..8b8702a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2004-12-14 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR c++/17242
+ * configure.ac: Add GAS check for HP-UX .nsubspa comdat.
+ * configure, config.in: Rebuilt.
+ * config/pa/pa-hpux10.h (SUPPORTS_ONE_ONLY, MAKE_DECL_ONE_ONLY): Delete
+ defines.
+ * config/pa/pa.c (pa_select_section): Allow uninitialized variables in
+ one-only (comdat) subspaces.
+ * config/pa/som.h (SUPPORTS_SOM_COMDAT): New define.
+ (SUPPORTS_ONE_ONLY): True if SUPPORTS_WEAK or SUPPORTS_SOM_COMDAT are
+ true.
+ (MAKE_DECL_ONE_ONLY): Place uninitialized variables in common.
+
2004-12-14 Ian Lance Taylor <ian@wasabisystems.com>
* combine.c (combine_validate_cost): Consider cost of
diff --git a/gcc/config.in b/gcc/config.in
index d819cf7..daa0459 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -297,6 +297,9 @@
skip when using the GAS .p2align command. */
#undef HAVE_GAS_MAX_SKIP_P2ALIGN
+/* Define if your assembler supports .nsubspa comdat option. */
+#undef HAVE_GAS_NSUBSPA_COMDAT
+
/* Define if your assembler and linker support 32-bit section relative relocs
via '.secrel32 label'. */
#undef HAVE_GAS_PE_SECREL32_RELOC
diff --git a/gcc/config/pa/pa-hpux10.h b/gcc/config/pa/pa-hpux10.h
index 86bc735..8c24793 100644
--- a/gcc/config/pa/pa-hpux10.h
+++ b/gcc/config/pa/pa-hpux10.h
@@ -147,10 +147,3 @@ Boston, MA 02111-1307, USA. */
better than the assembler shipped with older versions of hpux. */
#undef NEW_HP_ASSEMBLER
#define NEW_HP_ASSEMBLER 1
-
-/* CVS GAS as of 4/28/04 supports a comdat parameter for the .nsubspa
- directive. This provides one only linkage semantics even though we
- don't have weak support. */
-#undef SUPPORTS_ONE_ONLY
-#define SUPPORTS_ONE_ONLY (TARGET_GAS)
-#undef MAKE_DECL_ONE_ONLY
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 5f21e17..707bb5d 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -9350,8 +9350,7 @@ pa_select_section (tree exp, int reloc,
else if (TARGET_SOM
&& TREE_CODE (exp) == VAR_DECL
&& DECL_ONE_ONLY (exp)
- && !DECL_WEAK (exp)
- && DECL_INITIAL (exp))
+ && !DECL_WEAK (exp))
som_one_only_data_section ();
else
data_section ();
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index ac01ca1..96dc2a9 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -311,11 +311,30 @@ do { \
#define SUPPORTS_WEAK 0
#endif
-/* We can support one only if we support weak. */
-#define SUPPORTS_ONE_ONLY SUPPORTS_WEAK
+/* CVS GAS as of 4/28/04 supports a comdat parameter for the .nsubspa
+ directive. This provides one-only linkage semantics even though we
+ don't have weak support. */
+#ifdef HAVE_GAS_NSUBSPA_COMDAT
+#define SUPPORTS_SOM_COMDAT (TARGET_GAS)
+#else
+#define SUPPORTS_SOM_COMDAT 0
+#endif
-/* Use weak (secondary definitions) to make one only declarations. */
-#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+/* We can support one only if we support weak or comdat. */
+#define SUPPORTS_ONE_ONLY (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
+ initialized variables and functions. */
+#define MAKE_DECL_ONE_ONLY(DECL) \
+ do { \
+ 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; \
+ } while (0)
/* This is how we tell the assembler that a symbol is weak. The SOM
weak implementation uses the secondary definition (sdef) flag.
diff --git a/gcc/configure b/gcc/configure
index 5d1aa1e..00ce7c0 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13212,6 +13212,44 @@ _ACEOF
fi
+echo "$as_me:$LINENO: checking assembler for .nsubspa comdat" >&5
+echo $ECHO_N "checking assembler for .nsubspa comdat... $ECHO_C" >&6
+if test "${gcc_cv_as_nsubspa_comdat+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_nsubspa_comdat=no
+ if test $in_tree_gas = yes; then
+ if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 15 \) \* 1000 + 91`
+ then gcc_cv_as_nsubspa_comdat=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo ' .SPACE $TEXT$
+ .NSUBSPA $CODE$,COMDAT' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ gcc_cv_as_nsubspa_comdat=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_nsubspa_comdat" >&5
+echo "${ECHO_T}$gcc_cv_as_nsubspa_comdat" >&6
+if test $gcc_cv_as_nsubspa_comdat = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GAS_NSUBSPA_COMDAT 1
+_ACEOF
+
+fi
+
# .hidden needs to be supported in both the assembler and the linker,
# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
# This is irritatingly difficult to feature test for; we have to check the
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b261551..3936aa4 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2047,6 +2047,12 @@ gcc_GAS_CHECK_FEATURE([.weak], gcc_cv_as_weak,
[ .weak foobar],,
[AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.])])
+gcc_GAS_CHECK_FEATURE([.nsubspa comdat], gcc_cv_as_nsubspa_comdat,
+ [2,15,91],,
+ [ .SPACE $TEXT$
+ .NSUBSPA $CODE$,COMDAT],,
+[AC_DEFINE(HAVE_GAS_NSUBSPA_COMDAT, 1, [Define if your assembler supports .nsubspa comdat option.])])
+
# .hidden needs to be supported in both the assembler and the linker,
# because GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN.
# This is irritatingly difficult to feature test for; we have to check the