aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2018-05-25 07:57:10 +0000
committerRainer Orth <ro@gcc.gnu.org>2018-05-25 07:57:10 +0000
commitf8d704048f0900b88a459a60c5fed0e9b7ed8658 (patch)
tree9946373293ac81d336c677b6b3aa3049f182b4bd /gcc
parent9d4ac06e0235697c7fa3144b6790b779e6385ea5 (diff)
downloadgcc-f8d704048f0900b88a459a60c5fed0e9b7ed8658.zip
gcc-f8d704048f0900b88a459a60c5fed0e9b7ed8658.tar.gz
gcc-f8d704048f0900b88a459a60c5fed0e9b7ed8658.tar.bz2
Support SHF_EXCLUDE on non-x86 and with Solaris as
* configure.ac (gcc_cv_as_section_has_e): Move to common section. Rename to... (gcc_cv_as_section_exclude): ... this. Try Solaris as #exclude syntax. * configure: Regenerate. * config.in: Regenerate. * config/i386/i386.c (i386_solaris_elf_named_section): Handle SECTION_EXCLUDE. * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section) [HAVE_GAS_SECTION_EXCLUDE]: Handle SECTION_EXCLUDE. * varasm.c (default_elf_asm_named_section): Don't check if HAVE_GAS_SECTION_EXCLUDE is defined. From-SVN: r260708
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config.in2
-rw-r--r--gcc/config/i386/i386.c9
-rw-r--r--gcc/config/sparc/sparc.c4
-rwxr-xr-xgcc/configure123
-rw-r--r--gcc/configure.ac38
-rw-r--r--gcc/varasm.c2
7 files changed, 142 insertions, 52 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c258af3..9dd687a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2018-05-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (gcc_cv_as_section_has_e): Move to common section.
+ Rename to...
+ (gcc_cv_as_section_exclude): ... this.
+ Try Solaris as #exclude syntax.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * config/i386/i386.c (i386_solaris_elf_named_section): Handle
+ SECTION_EXCLUDE.
+ * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section)
+ [HAVE_GAS_SECTION_EXCLUDE]: Handle SECTION_EXCLUDE.
+
+ * varasm.c (default_elf_asm_named_section): Don't check if
+ HAVE_GAS_SECTION_EXCLUDE is defined.
+
2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
* doc/md.texi: Update the documentation of the cond_* optabs
diff --git a/gcc/config.in b/gcc/config.in
index 5bccb40..2856e72 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1323,7 +1323,7 @@
#endif
-/* Define if your assembler supports specifying the section flag e. */
+/* Define if your assembler supports specifying the exclude section flag. */
#ifndef USED_FOR_TARGET
#undef HAVE_GAS_SECTION_EXCLUDE
#endif
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 184b721..637c105 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -45905,6 +45905,15 @@ i386_solaris_elf_named_section (const char *name, unsigned int flags,
solaris_elf_asm_comdat_section (name, flags, decl);
return;
}
+
+ /* Solaris/x86 as uses the same syntax for the SHF_EXCLUDE flags as the
+ SPARC assembler. One cannot mix single-letter flags and #exclude, so
+ only emit the latter here. */
+ if (flags & SECTION_EXCLUDE)
+ {
+ fprintf (asm_out_file, "\t.section\t%s,#exclude\n", name);
+ return;
+ }
#endif
default_elf_asm_named_section (name, flags, decl);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 768ee2b..6b6f155 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -10502,6 +10502,10 @@ sparc_solaris_elf_asm_named_section (const char *name, unsigned int flags,
if (!(flags & SECTION_DEBUG))
fputs (",#alloc", asm_out_file);
+#if HAVE_GAS_SECTION_EXCLUDE
+ if (flags & SECTION_EXCLUDE)
+ fputs (",#exclude", asm_out_file);
+#endif
if (flags & SECTION_WRITE)
fputs (",#write", asm_out_file);
if (flags & SECTION_TLS)
diff --git a/gcc/configure b/gcc/configure
index 7d69faf..60d3739 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23514,6 +23514,89 @@ $as_echo "#define USE_AS_TRADITIONAL_FORMAT 1" >>confdefs.h
fi
+# Test if the assembler supports the section flag 'e' or #exclude for
+# specifying an excluded section.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for section exclude flag" >&5
+$as_echo_n "checking assembler for section exclude flag... " >&6; }
+if test "${gcc_cv_as_section_exclude_e+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_section_exclude_e=no
+ if test $in_tree_gas = yes; then
+ if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 22 \) \* 1000 + 51`
+ then gcc_cv_as_section_exclude_e=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ $as_echo '.section foo1,"e"
+ .byte 0,0,0,0' > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_section_exclude_e=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_section_exclude_e" >&5
+$as_echo "$gcc_cv_as_section_exclude_e" >&6; }
+
+
+if test $gcc_cv_as_section_exclude_e = no; then
+ case "${target}" in
+ # Solaris as uses #exclude instead.
+ *-*-solaris2*)
+ case "${target}" in
+ sparc*-*-solaris2*)
+ conftest_s='.section "foo1", #exclude'
+ ;;
+ i?86-*-solaris2* | x86_64-*-solaris2*)
+ conftest_s='.section foo1, #exclude'
+ ;;
+ esac
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for section exclude flag" >&5
+$as_echo_n "checking assembler for section exclude flag... " >&6; }
+if test "${gcc_cv_as_section_exclude_hash+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_section_exclude_hash=no
+ if test x$gcc_cv_as != x; then
+ $as_echo "$conftest_s
+ .byte 0,0,0,0" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_section_exclude_hash=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_section_exclude_hash" >&5
+$as_echo "$gcc_cv_as_section_exclude_hash" >&6; }
+
+
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GAS_SECTION_EXCLUDE `if test $gcc_cv_as_section_exclude_e = yes || test $gcc_cv_as_section_exclude_hash = yes; then echo 1; else echo 0; fi`
+_ACEOF
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for section merging support" >&5
$as_echo_n "checking assembler for section merging support... " >&6; }
if test "${gcc_cv_as_shf_merge+set}" = set; then :
@@ -25671,46 +25754,6 @@ $as_echo "#define HAVE_AS_XBRACE_COMMENT_OPTION 1" >>confdefs.h
fi
- # Test if the assembler supports the section flag 'e' for specifying
- # an excluded section.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .section with e" >&5
-$as_echo_n "checking assembler for .section with e... " >&6; }
-if test "${gcc_cv_as_section_has_e+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- gcc_cv_as_section_has_e=no
- if test $in_tree_gas = yes; then
- if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 22 \) \* 1000 + 51`
- then gcc_cv_as_section_has_e=yes
-fi
- elif test x$gcc_cv_as != x; then
- $as_echo '.section foo1,"e"
-.byte 0,0,0,0' > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }
- then
- gcc_cv_as_section_has_e=yes
- else
- echo "configure: failed program was" >&5
- cat conftest.s >&5
- fi
- rm -f conftest.o conftest.s
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_section_has_e" >&5
-$as_echo "$gcc_cv_as_section_has_e" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_GAS_SECTION_EXCLUDE `if test $gcc_cv_as_section_has_e = yes; then echo 1; else echo 0; fi`
-_ACEOF
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for filds and fists mnemonics" >&5
$as_echo_n "checking assembler for filds and fists mnemonics... " >&6; }
if test "${gcc_cv_as_ix86_filds+set}" = set; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 36124b8..010ecd2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2953,6 +2953,34 @@ if test $gcc_cv_as_eh_frame = buggy; then
[Define if your assembler mis-optimizes .eh_frame data.])
fi
+# Test if the assembler supports the section flag 'e' or #exclude for
+# specifying an excluded section.
+gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_e,
+ [2,22,51], [--fatal-warnings],
+ [.section foo1,"e"
+ .byte 0,0,0,0])
+if test $gcc_cv_as_section_exclude_e = no; then
+ case "${target}" in
+ # Solaris as uses #exclude instead.
+ *-*-solaris2*)
+ case "${target}" in
+ sparc*-*-solaris2*)
+ conftest_s='.section "foo1", #exclude'
+ ;;
+ i?86-*-solaris2* | x86_64-*-solaris2*)
+ conftest_s='.section foo1, #exclude'
+ ;;
+ esac
+ ;;
+ esac
+ gcc_GAS_CHECK_FEATURE([section exclude flag], gcc_cv_as_section_exclude_hash,,,
+ [$conftest_s
+ .byte 0,0,0,0])
+fi
+AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
+ [`if test $gcc_cv_as_section_exclude_e = yes || test $gcc_cv_as_section_exclude_hash = yes; then echo 1; else echo 0; fi`],
+[Define if your assembler supports specifying the exclude section flag.])
+
gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
[elf,2,12,0], [--fatal-warnings],
[.section .rodata.str, "aMS", @progbits, 1])
@@ -4202,16 +4230,6 @@ foo: nop
[AC_DEFINE(HAVE_AS_XBRACE_COMMENT_OPTION, 1,
[Define if your assembler supports -xbrace_comment option.])])
- # Test if the assembler supports the section flag 'e' for specifying
- # an excluded section.
- gcc_GAS_CHECK_FEATURE([.section with e], gcc_cv_as_section_has_e,
- [2,22,51], [--fatal-warnings],
-[.section foo1,"e"
-.byte 0,0,0,0])
- AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
- [`if test $gcc_cv_as_section_has_e = yes; then echo 1; else echo 0; fi`],
- [Define if your assembler supports specifying the section flag e.])
-
gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
gcc_cv_as_ix86_filds,,,
[filds (%ebp); fists (%ebp)],,
diff --git a/gcc/varasm.c b/gcc/varasm.c
index bff4345..6b9f87b 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -6449,7 +6449,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
{
if (!(flags & SECTION_DEBUG))
*f++ = 'a';
-#if defined (HAVE_GAS_SECTION_EXCLUDE) && HAVE_GAS_SECTION_EXCLUDE == 1
+#if HAVE_GAS_SECTION_EXCLUDE
if (flags & SECTION_EXCLUDE)
*f++ = 'e';
#endif