aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2018-10-24 11:27:35 +0000
committerRainer Orth <ro@gcc.gnu.org>2018-10-24 11:27:35 +0000
commitdc6b6330c5d708ba319778b2befed0b7314271b8 (patch)
tree9ac6e997fc7dddbff9a6f78b9fd4c4e4b7715b61 /gcc
parent53b8a7107e6c6a774d5e69b8fd5ce46e94c35adb (diff)
downloadgcc-dc6b6330c5d708ba319778b2befed0b7314271b8.zip
gcc-dc6b6330c5d708ba319778b2befed0b7314271b8.tar.gz
gcc-dc6b6330c5d708ba319778b2befed0b7314271b8.tar.bz2
Disable string merging with alignment > 1 before Solaris 11.4/SPARC
* configure.ac (gcc_cv_ld_aligned_shf_merge): New test. * configure: Regenerate. * config.in: Regenerate. * varasm.c (mergeable_string_section): Use readonly_data_section if linker doesn't support SHF_MERGE with alignment > 8. (mergeable_constant_section): Likewise. From-SVN: r265456
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config.in18
-rwxr-xr-xgcc/configure24
-rw-r--r--gcc/configure.ac22
-rw-r--r--gcc/varasm.c6
5 files changed, 69 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9240277..55ac3b9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2018-10-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (gcc_cv_ld_aligned_shf_merge): New test.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * varasm.c (mergeable_string_section): Use readonly_data_section
+ if linker doesn't support SHF_MERGE with alignment > 8.
+ (mergeable_constant_section): Likewise.
+
2018-10-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/84013
diff --git a/gcc/config.in b/gcc/config.in
index b807d49..7116579 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -55,8 +55,7 @@
#endif
-/* Define to larger than zero set to the default stack clash protector size as
- a power of two in bytes. */
+/* Define to larger than zero set the default stack clash protector size. */
#ifndef USED_FOR_TARGET
#undef DEFAULT_STK_CLASH_GUARD_SIZE
#endif
@@ -1430,6 +1429,13 @@
#endif
+/* Define 0/1 if your linker supports the SHF_MERGE flag with section
+ alignment > 1. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_ALIGNED_SHF_MERGE
+#endif
+
+
/* Define if your linker supports --as-needed/--no-as-needed or equivalent
options. */
#ifndef USED_FOR_TARGET
@@ -1993,13 +1999,7 @@
#endif
-/* Define if we should link with --large-address-aware by default */
-#ifndef USED_FOR_TARGET
-#undef MINGW_DEFAULT_LARGE_ADDR_AWARE
-#endif
-
-
-/* Define if we should link with --large-address-aware by default */
+/* Define if we should link mingw executables with --large-address-aware */
#ifndef USED_FOR_TARGET
#undef MINGW_DEFAULT_LARGE_ADDR_AWARE
#endif
diff --git a/gcc/configure b/gcc/configure
index fb1c707..c49b4b2 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23739,6 +23739,30 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+gcc_cv_ld_aligned_shf_merge=yes
+case "$target" in
+ # While Solaris 10/SPARC ld isn't affected, disable to avoid problems
+ # relinking on Solaris 11 < 11.4.
+ sparc*-*-solaris2.10*)
+ if test x"$gnu_ld" = xno; then
+ gcc_cv_ld_aligned_shf_merge=no
+ fi
+ ;;
+ # SHF_MERGE support is broken in Solaris ld up to Solaris 11.3/SPARC for
+ # alignment > 1.
+ sparc*-*-solaris2.11*)
+ if test x"$gnu_ld" = xno \
+ && test "$ld_vers_major" -lt 2 && test "$ld_vers_minor" -lt 3159; then
+ gcc_cv_ld_aligned_shf_merge=no
+ fi
+ ;;
+esac
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LD_ALIGNED_SHF_MERGE `if test $gcc_cv_ld_aligned_shf_merge = yes; then echo 1; else echo 0; fi`
+_ACEOF
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for stabs directive" >&5
$as_echo_n "checking assembler for stabs directive... " >&6; }
if test "${gcc_cv_as_stabs_directive+set}" = set; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 3b70d53..f43af0b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3039,6 +3039,28 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
[`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
+gcc_cv_ld_aligned_shf_merge=yes
+case "$target" in
+ # While Solaris 10/SPARC ld isn't affected, disable to avoid problems
+ # relinking on Solaris 11 < 11.4.
+ sparc*-*-solaris2.10*)
+ if test x"$gnu_ld" = xno; then
+ gcc_cv_ld_aligned_shf_merge=no
+ fi
+ ;;
+ # SHF_MERGE support is broken in Solaris ld up to Solaris 11.3/SPARC for
+ # alignment > 1.
+ sparc*-*-solaris2.11*)
+ if test x"$gnu_ld" = xno \
+ && test "$ld_vers_major" -lt 2 && test "$ld_vers_minor" -lt 3159; then
+ gcc_cv_ld_aligned_shf_merge=no
+ fi
+ ;;
+esac
+AC_DEFINE_UNQUOTED(HAVE_LD_ALIGNED_SHF_MERGE,
+ [`if test $gcc_cv_ld_aligned_shf_merge = yes; then echo 1; else echo 0; fi`],
+[Define 0/1 if your linker supports the SHF_MERGE flag with section alignment > 1.])
+
gcc_GAS_CHECK_FEATURE([stabs directive], gcc_cv_as_stabs_directive, ,,
[.stabs "gcc2_compiled.",60,0,0,0],,
[AC_DEFINE(HAVE_AS_STABS_DIRECTIVE, 1,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 91650ee..06f41d0 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -823,6 +823,9 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
if (align < modesize)
align = modesize;
+ if (!HAVE_LD_ALIGNED_SHF_MERGE && align > 8)
+ return readonly_data_section;
+
str = TREE_STRING_POINTER (decl);
unit = GET_MODE_SIZE (mode);
@@ -861,7 +864,8 @@ mergeable_constant_section (machine_mode mode ATTRIBUTE_UNUSED,
&& known_le (GET_MODE_BITSIZE (mode), align)
&& align >= 8
&& align <= 256
- && (align & (align - 1)) == 0)
+ && (align & (align - 1)) == 0
+ && (HAVE_LD_ALIGNED_SHF_MERGE ? 1 : align == 8))
{
const char *prefix = function_mergeable_rodata_prefix ();
char *name = (char *) alloca (strlen (prefix) + 30);