aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2015-11-09 11:33:30 +0000
committerRainer Orth <ro@gcc.gnu.org>2015-11-09 11:33:30 +0000
commite6b6bf09dd34ed9a35cbc7d37d0fde1849450aad (patch)
tree9a09dfb3e59bf363b6034ae58ed47450b706338a /gcc
parente1c78addb3eb56f659b47756e41e6e956d5c85ab (diff)
downloadgcc-e6b6bf09dd34ed9a35cbc7d37d0fde1849450aad.zip
gcc-e6b6bf09dd34ed9a35cbc7d37d0fde1849450aad.tar.gz
gcc-e6b6bf09dd34ed9a35cbc7d37d0fde1849450aad.tar.bz2
Support init priority on Solaris
libgcc: * config/ia64/crtbegin.S: Check HAVE_INITFINI_ARRAY_SUPPORT value. * config/ia64/crtend.S: Likewise. gcc: * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Allow for differences in assembler syntax. Support Solaris ld. Define HAVE_INITFINI_ARRAY_SUPPORT as 0/1. * config/sol2.h (SUPPORTS_INIT_PRIORITY): Define to HAVE_INITFINI_ARRAY_SUPPORT. * config/initfini-array.h: Check HAVE_INITFINI_ARRAY_SUPPORT value. * configure.ac (gcc_cv_as_sparc_nobits): Remove. * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section): Don't check HAVE_AS_SPARC_NOBITS. Heed SECTION_NOTYPE. * configure: Regenerate. * config.in: Regenerate. From-SVN: r230013
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/acinclude.m495
-rw-r--r--gcc/config.in9
-rw-r--r--gcc/config/initfini-array.h2
-rw-r--r--gcc/config/sol2.h6
-rw-r--r--gcc/config/sparc/sparc.c14
-rwxr-xr-xgcc/configure127
-rw-r--r--gcc/configure.ac7
8 files changed, 179 insertions, 101 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 510f5ee..4ebfc52 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2015-11-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Allow for differences in
+ assembler syntax.
+ Support Solaris ld.
+ Define HAVE_INITFINI_ARRAY_SUPPORT as 0/1.
+
+ * config/sol2.h (SUPPORTS_INIT_PRIORITY): Define to
+ HAVE_INITFINI_ARRAY_SUPPORT.
+ * config/initfini-array.h: Check HAVE_INITFINI_ARRAY_SUPPORT
+ value.
+
+ * configure.ac (gcc_cv_as_sparc_nobits): Remove.
+ * config/sparc/sparc.c (sparc_solaris_elf_asm_named_section):
+ Don't check HAVE_AS_SPARC_NOBITS.
+ Heed SECTION_NOTYPE.
+
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2015-11-09 Eric Botcazou <ebotcazou@adacore.com>
PR middle-end/68253
diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index 0bcd844..b8a4c28 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -309,43 +309,96 @@ int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
gcc_cv_initfini_array=yes
fi
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
- cat > conftest.s <<\EOF
-.section .dtors,"a",%progbits
+ case $target:$gas in
+ *:yes)
+ sh_flags='"a"'
+ sh_type='%progbits'
+ ;;
+ i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
+ sh_flags='"a"'
+ sh_type='@progbits'
+ ;;
+ sparc*-*-solaris2*:no)
+ sh_flags='#alloc'
+ sh_type='#progbits'
+ sh_quote='"'
+ ;;
+ esac
+ case "$target:$gnu_ld" in
+ *:yes)
+ cat > conftest.s <<EOF
+.section .dtors,$sh_flags,$sh_type
.balign 4
.byte 'A', 'A', 'A', 'A'
-.section .ctors,"a",%progbits
+.section .ctors,$sh_flags,$sh_type
.balign 4
.byte 'B', 'B', 'B', 'B'
-.section .fini_array.65530,"a",%progbits
+.section .fini_array.65530,$sh_flags,$sh_type
.balign 4
.byte 'C', 'C', 'C', 'C'
-.section .init_array.65530,"a",%progbits
+.section .init_array.65530,$sh_flags,$sh_type
.balign 4
.byte 'D', 'D', 'D', 'D'
-.section .dtors.64528,"a",%progbits
+.section .dtors.64528,$sh_flags,$sh_type
.balign 4
.byte 'E', 'E', 'E', 'E'
-.section .ctors.64528,"a",%progbits
+.section .ctors.64528,$sh_flags,$sh_type
.balign 4
.byte 'F', 'F', 'F', 'F'
-.section .fini_array.01005,"a",%progbits
+.section .fini_array.01005,$sh_flags,$sh_type
.balign 4
.byte 'G', 'G', 'G', 'G'
-.section .init_array.01005,"a",%progbits
+.section .init_array.01005,$sh_flags,$sh_type
.balign 4
.byte 'H', 'H', 'H', 'H'
.text
.globl _start
_start:
EOF
- if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
- && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
- && $gcc_cv_objdump -s -j .init_array conftest \
- | grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
- && $gcc_cv_objdump -s -j .fini_array conftest \
- | grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
- gcc_cv_initfini_array=yes
- fi
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
+ && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .init_array conftest \
+ | grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .fini_array conftest \
+ | grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
+ gcc_cv_initfini_array=yes
+ fi
+ ;;
+ *-*-solaris2*:no)
+ # When Solaris ld added constructor priority support, it was
+ # decided to only handle .init_array.N/.fini_array.N since
+ # there was no need for backwards compatibility with
+ # .ctors.N/.dtors.N. .ctors/.dtors remain as separate
+ # sections with correct execution order resp. to
+ # .init_array/.fini_array, while gld merges them into
+ # .init_array/.fini_array.
+ cat > conftest.s <<EOF
+.section $sh_quote.fini_array.65530$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'C', 'C', 'C', 'C'
+.section $sh_quote.init_array.65530$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'D', 'D', 'D', 'D'
+.section $sh_quote.fini_array.01005$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'G', 'G', 'G', 'G'
+.section $sh_quote.init_array.01005$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'H', 'H', 'H', 'H'
+.text
+.globl _start
+_start:
+EOF
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
+ && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .init_array conftest \
+ | grep HHHHDDDD > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .fini_array conftest \
+ | grep GGGGCCCC > /dev/null 2>&1; then
+ gcc_cv_initfini_array=yes
+ fi
+ ;;
+ esac
changequote(,)dnl
rm -f conftest conftest.*
changequote([,])dnl
@@ -375,10 +428,10 @@ changequote([,])dnl
fi])
enable_initfini_array=$gcc_cv_initfini_array
])
-if test $enable_initfini_array = yes; then
- AC_DEFINE(HAVE_INITFINI_ARRAY_SUPPORT, 1,
- [Define .init_array/.fini_array sections are available and working.])
-fi])
+AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY_SUPPORT,
+ [`if test $enable_initfini_array = yes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if .init_array/.fini_array sections are available and working.])
+])
dnl # _gcc_COMPUTE_GAS_VERSION
dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
diff --git a/gcc/config.in b/gcc/config.in
index 6f46f70..eb1ea10 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -598,12 +598,6 @@
#endif
-/* Define to 1 if your assembler supports #nobits, 0 otherwise. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_SPARC_NOBITS
-#endif
-
-
/* Define if your assembler and linker support unaligned PC relative relocs.
*/
#ifndef USED_FOR_TARGET
@@ -1329,7 +1323,8 @@
#endif
-/* Define .init_array/.fini_array sections are available and working. */
+/* Define 0/1 if .init_array/.fini_array sections are available and working.
+ */
#ifndef USED_FOR_TARGET
#undef HAVE_INITFINI_ARRAY_SUPPORT
#endif
diff --git a/gcc/config/initfini-array.h b/gcc/config/initfini-array.h
index 06da397..59adede 100644
--- a/gcc/config/initfini-array.h
+++ b/gcc/config/initfini-array.h
@@ -23,7 +23,7 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifdef HAVE_INITFINI_ARRAY_SUPPORT
+#if HAVE_INITFINI_ARRAY_SUPPORT
#define USE_INITFINI_ARRAY
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index f444e48..6bf0599 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -398,11 +398,9 @@ along with GCC; see the file COPYING3. If not see
#define NO_DBX_BNSYM_ENSYM 1
#endif
-#ifndef USE_GLD
-/* The Solaris linker doesn't understand constructor priorities. */
+/* Enable constructor priorities if the configured linker supports it. */
#undef SUPPORTS_INIT_PRIORITY
-#define SUPPORTS_INIT_PRIORITY 0
-#endif
+#define SUPPORTS_INIT_PRIORITY HAVE_INITFINI_ARRAY_SUPPORT
/* Solaris has an implementation of __enable_execute_stack. */
#define HAVE_ENABLE_EXECUTE_STACK
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 6d877d6..28c2c63 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -9868,14 +9868,12 @@ sparc_solaris_elf_asm_named_section (const char *name, unsigned int flags,
if (flags & SECTION_CODE)
fputs (",#execinstr", asm_out_file);
- /* Sun as only supports #nobits/#progbits since Solaris 10. */
- if (HAVE_AS_SPARC_NOBITS)
- {
- if (flags & SECTION_BSS)
- fputs (",#nobits", asm_out_file);
- else
- fputs (",#progbits", asm_out_file);
- }
+ if (flags & SECTION_NOTYPE)
+ ;
+ else if (flags & SECTION_BSS)
+ fputs (",#nobits", asm_out_file);
+ else
+ fputs (",#progbits", asm_out_file);
fputc ('\n', asm_out_file);
}
diff --git a/gcc/configure b/gcc/configure
index 1d2e8f2..de6cf13 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -22930,43 +22930,96 @@ fi
gcc_cv_initfini_array=yes
fi
elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
- cat > conftest.s <<\EOF
-.section .dtors,"a",%progbits
+ case $target:$gas in
+ *:yes)
+ sh_flags='"a"'
+ sh_type='%progbits'
+ ;;
+ i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
+ sh_flags='"a"'
+ sh_type='@progbits'
+ ;;
+ sparc*-*-solaris2*:no)
+ sh_flags='#alloc'
+ sh_type='#progbits'
+ sh_quote='"'
+ ;;
+ esac
+ case "$target:$gnu_ld" in
+ *:yes)
+ cat > conftest.s <<EOF
+.section .dtors,$sh_flags,$sh_type
.balign 4
.byte 'A', 'A', 'A', 'A'
-.section .ctors,"a",%progbits
+.section .ctors,$sh_flags,$sh_type
.balign 4
.byte 'B', 'B', 'B', 'B'
-.section .fini_array.65530,"a",%progbits
+.section .fini_array.65530,$sh_flags,$sh_type
.balign 4
.byte 'C', 'C', 'C', 'C'
-.section .init_array.65530,"a",%progbits
+.section .init_array.65530,$sh_flags,$sh_type
.balign 4
.byte 'D', 'D', 'D', 'D'
-.section .dtors.64528,"a",%progbits
+.section .dtors.64528,$sh_flags,$sh_type
.balign 4
.byte 'E', 'E', 'E', 'E'
-.section .ctors.64528,"a",%progbits
+.section .ctors.64528,$sh_flags,$sh_type
.balign 4
.byte 'F', 'F', 'F', 'F'
-.section .fini_array.01005,"a",%progbits
+.section .fini_array.01005,$sh_flags,$sh_type
.balign 4
.byte 'G', 'G', 'G', 'G'
-.section .init_array.01005,"a",%progbits
+.section .init_array.01005,$sh_flags,$sh_type
.balign 4
.byte 'H', 'H', 'H', 'H'
.text
.globl _start
_start:
EOF
- if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
- && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
- && $gcc_cv_objdump -s -j .init_array conftest \
- | grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
- && $gcc_cv_objdump -s -j .fini_array conftest \
- | grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
- gcc_cv_initfini_array=yes
- fi
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
+ && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .init_array conftest \
+ | grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .fini_array conftest \
+ | grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
+ gcc_cv_initfini_array=yes
+ fi
+ ;;
+ *-*-solaris2*:no)
+ # When Solaris ld added constructor priority support, it was
+ # decided to only handle .init_array.N/.fini_array.N since
+ # there was no need for backwards compatibility with
+ # .ctors.N/.dtors.N. .ctors/.dtors remain as separate
+ # sections with correct execution order resp. to
+ # .init_array/.fini_array, while gld merges them into
+ # .init_array/.fini_array.
+ cat > conftest.s <<EOF
+.section $sh_quote.fini_array.65530$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'C', 'C', 'C', 'C'
+.section $sh_quote.init_array.65530$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'D', 'D', 'D', 'D'
+.section $sh_quote.fini_array.01005$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'G', 'G', 'G', 'G'
+.section $sh_quote.init_array.01005$sh_quote,$sh_flags,$sh_type
+.align 4
+.byte 'H', 'H', 'H', 'H'
+.text
+.globl _start
+_start:
+EOF
+ if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
+ && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .init_array conftest \
+ | grep HHHHDDDD > /dev/null 2>&1 \
+ && $gcc_cv_objdump -s -j .fini_array conftest \
+ | grep GGGGCCCC > /dev/null 2>&1; then
+ gcc_cv_initfini_array=yes
+ fi
+ ;;
+ esac
rm -f conftest conftest.*
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -23009,11 +23062,12 @@ $as_echo "$gcc_cv_initfini_array" >&6; }
fi
-if test $enable_initfini_array = yes; then
-$as_echo "#define HAVE_INITFINI_ARRAY_SUPPORT 1" >>confdefs.h
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INITFINI_ARRAY_SUPPORT `if test $enable_initfini_array = yes; then echo 1; else echo 0; fi`
+_ACEOF
+
-fi
# Check if we have .[us]leb128, and support symbol arithmetic with it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .sleb128 and .uleb128" >&5
@@ -24667,39 +24721,6 @@ $as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>confdefs.h
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for #nobits" >&5
-$as_echo_n "checking assembler for #nobits... " >&6; }
-if test "${gcc_cv_as_sparc_nobits+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- gcc_cv_as_sparc_nobits=no
- if test x$gcc_cv_as != x; then
- $as_echo '.section "nobits",#alloc,#write,#nobits
- .section "progbits",#alloc,#write,#progbits' > 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_sparc_nobits=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_sparc_nobits" >&5
-$as_echo "$gcc_cv_as_sparc_nobits" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_AS_SPARC_NOBITS `if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`
-_ACEOF
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -relax option" >&5
$as_echo_n "checking assembler for -relax option... " >&6; }
if test "${gcc_cv_as_sparc_relax+set}" = set; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index d03a0bd..7670824 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3754,13 +3754,6 @@ AS_HELP_STRING([--disable-fix-cortex-a53-843419],
[AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
[Define if your assembler supports .register.])])
- gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,,
- [.section "nobits",#alloc,#write,#nobits
- .section "progbits",#alloc,#write,#progbits])
- AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS,
- [`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`],
- [Define to 1 if your assembler supports #nobits, 0 otherwise.])
-
gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
[-relax], [.text],,
[AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,