diff options
author | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-20 11:47:25 +0000 |
---|---|---|
committer | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-02-20 11:47:25 +0000 |
commit | 1c6e4ce9d88b644e398b2f4337195cd497841a04 (patch) | |
tree | a77f9137c76c7d39fcac1110b79efb90d3a95ab7 /gcc/configure | |
parent | eeff6a54fe4eef656054dfb2053e1d4b006720ac (diff) | |
download | ppe42-gcc-1c6e4ce9d88b644e398b2f4337195cd497841a04.tar.gz ppe42-gcc-1c6e4ce9d88b644e398b2f4337195cd497841a04.zip |
Enable initfini array support on Solaris (PR target/50166)
* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Require gcc_SUN_LD_VERSION.
Define _start.
Remove -e 0 from $gcc_cv_ld invocation.
Only use __GLIBC_PREREQ if defined.
Enable on Solaris since Solaris 8 patch.
(gcc_SUN_LD_VERSION): New macro.
* configure.ac (ld_ver) <*-*-solaris2*>: Refer to
gcc_SUN_LD_VERSION for version number format.
* configure: Regenerate.
* varasm.c (get_elf_initfini_array_priority_section): Set
SECTION_NOTYPE for non-default priority.
Use get_section instead of get_unnamed_section to emit
.init_array/.fini_array with default priority.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184390 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/configure')
-rwxr-xr-x | gcc/configure | 69 |
1 files changed, 57 insertions, 12 deletions
diff --git a/gcc/configure b/gcc/configure index 15a9ece5e6f..2a84fc37073 100755 --- a/gcc/configure +++ b/gcc/configure @@ -22214,15 +22214,11 @@ if test $in_tree_ld != yes ; then else case "${target}" in *-*-solaris2*) + # See acinclude.m4 (gcc_SUN_LD_VERSION) for the version number + # format. # - # Solaris 2 ld -V output looks like this for a regular version: - # - # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699 - # - # but test versions add stuff at the end: - # - # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 - # + # Don't reuse gcc_gv_sun_ld_vers_* in case a linker other than + # /usr/ccs/bin/ld has been configured. ld_ver=`$gcc_cv_ld -V 2>&1` if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then ld_vers=`echo $ld_ver | sed -n \ @@ -22350,6 +22346,29 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_ro_rw_mix" >&5 $as_echo "$gcc_cv_ld_ro_rw_mix" >&6; } +if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then + case "${target}" in + *-*-solaris2*) + # + # Solaris 2 ld -V output looks like this for a regular version: + # + # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699 + # + # but test versions add stuff at the end: + # + # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 + # + gcc_cv_sun_ld_ver=`/usr/ccs/bin/ld -V 2>&1` + if echo "$gcc_cv_sun_ld_ver" | grep 'Solaris Link Editors' > /dev/null; then + gcc_cv_sun_ld_vers=`echo $gcc_cv_sun_ld_ver | sed -n \ + -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` + gcc_cv_sun_ld_vers_major=`expr "$gcc_cv_sun_ld_vers" : '\([0-9]*\)'` + gcc_cv_sun_ld_vers_minor=`expr "$gcc_cv_sun_ld_vers" : '[0-9]*\.\([0-9]*\)'` + fi + ;; + esac +fi + # Check whether --enable-initfini-array was given. if test "${enable_initfini_array+set}" = set; then : enableval=$enable_initfini_array; @@ -22425,9 +22444,11 @@ fi .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 -e 0 -o conftest conftest.o > /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 \ @@ -22440,17 +22461,41 @@ EOF /* end confdefs.h. */ #ifndef __ELF__ -#error Not an ELF OS +# error Not an ELF OS #endif #include <stdlib.h> -#if defined __GLIBC_PREREQ && __GLIBC_PREREQ (2, 4) +#if defined __GLIBC_PREREQ +# if __GLIBC_PREREQ (2, 4) +# else +# error GLIBC 2.4 required +# endif #else -#error The C library not known to support .init_array/.fini_array +# if defined __sun__ && defined __svr4__ + /* Solaris ld.so.1 supports .init_array/.fini_array since Solaris 8. */ +# else +# error The C library not known to support .init_array/.fini_array +# endif #endif _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : + case "${target}" in + *-*-solaris2.8*) + # .init_array/.fini_array support was introduced in Solaris 8 + # patches 109147-08 (sparc) and 109148-08 (x86). Since ld.so.1 and + # ld are guaranteed to be updated in lockstep, we can check ld -V + # instead. Unfortunately, proper ld version numbers were only + # introduced in rev. -14, so we check for that. + if test "$gcc_cv_sun_ld_vers_minor" -lt 272; then + gcc_cv_initfini_array=no + fi + ;; + *-*-solaris2.9* | *-*-solaris2.1[0-9]*) + # .init_array/.fini_array support is present since Solaris 9 FCS. + ;; + esac + else gcc_cv_initfini_array=no fi |