From 477b521a56e0c2021fca91896f571318d10f1270 Mon Sep 17 00:00:00 2001 From: ro Date: Wed, 2 Jun 2010 17:39:39 +0000 Subject: [PATCH] * configure.ac (gcc_cv_ld_sol2_emulation): Test for GNU ld *_sol2 linker emulations. * configure: Regenerate. * config.in: Regenerate. * config/i386/sol2-10.h [TARGET_GNU_LD] (I386_EMULATION): Define. (X86_64_EMULATION): Define. (TARGET_LD_EMULATION): Use them. * config/sparc/sol2-gld-bi.h (SPARC32_EMULATION): Define. (SPARC64_EMULATION): Define. (LINK_ARCH_SPEC): Use them. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160178 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/config.in | 6 ++++++ gcc/config/i386/sol2-10.h | 13 ++++++++++++- gcc/config/sparc/sol2-gld-bi.h | 18 ++++++++++++++---- gcc/configure | 30 ++++++++++++++++++++++++++++++ gcc/configure.ac | 23 +++++++++++++++++++++++ 6 files changed, 100 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 915aa2d4b5b..3fb2eec149d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2010-06-02 Rainer Orth + + * configure.ac (gcc_cv_ld_sol2_emulation): Test for GNU ld *_sol2 + linker emulations. + * configure: Regenerate. + * config.in: Regenerate. + + * config/i386/sol2-10.h [TARGET_GNU_LD] (I386_EMULATION): Define. + (X86_64_EMULATION): Define. + (TARGET_LD_EMULATION): Use them. + + * config/sparc/sol2-gld-bi.h (SPARC32_EMULATION): Define. + (SPARC64_EMULATION): Define. + (LINK_ARCH_SPEC): Use them. + 2010-06-02 Sebastian Pop * graphite-clast-to-gimple.c (gcc_type_for_interval): Use diff --git a/gcc/config.in b/gcc/config.in index 86b237b2d7c..b7884a386d1 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1194,6 +1194,12 @@ #endif +/* Define if your linker supports the *_sol2 emulations. */ +#ifndef USED_FOR_TARGET +#undef HAVE_LD_SOL2_EMULATION +#endif + + /* Define if your linker supports -Bstatic/-Bdynamic option. */ #ifndef USED_FOR_TARGET #undef HAVE_LD_STATIC_DYNAMIC diff --git a/gcc/config/i386/sol2-10.h b/gcc/config/i386/sol2-10.h index 1cd28970114..d57ed7f9d69 100644 --- a/gcc/config/i386/sol2-10.h +++ b/gcc/config/i386/sol2-10.h @@ -120,7 +120,18 @@ along with GCC; see the file COPYING3. If not see #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE #ifdef TARGET_GNU_LD -#define TARGET_LD_EMULATION "%{m64:-m elf_x86_64}%{!m64:-m elf_i386} " +/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly + follow the Solaris 2 ABI. Prefer them if present. */ +#ifdef HAVE_LD_SOL2_EMULATION +#define I386_EMULATION "elf_i386_sol2" +#define X86_64_EMULATION "elf_x86_64_sol2" +#else +#define I386_EMULATION "elf_i386" +#define X86_64_EMULATION "elf_x86_64" +#endif + +#define TARGET_LD_EMULATION "%{m64:-m " X86_64_EMULATION "}" \ + "%{!m64:-m " I386_EMULATION "} " #else #define TARGET_LD_EMULATION "" #endif diff --git a/gcc/config/sparc/sol2-gld-bi.h b/gcc/config/sparc/sol2-gld-bi.h index ac767400966..04d5da45cf1 100644 --- a/gcc/config/sparc/sol2-gld-bi.h +++ b/gcc/config/sparc/sol2-gld-bi.h @@ -32,25 +32,35 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LINK_ARCH64_SPEC \ LINK_ARCH64_SPEC_BASE "%{!static: -rpath-link %R/usr/lib/sparcv9}" +/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly + follow the Solaris 2 ABI. Prefer them if present. */ +#ifdef HAVE_LD_SOL2_EMULATION +#define SPARC32_EMULATION "elf32_sparc_sol2" +#define SPARC64_EMULATION "elf64_sparc_sol2" +#else +#define SPARC32_EMULATION "elf32_sparc" +#define SPARC64_EMULATION "elf64_sparc" +#endif + #undef LINK_ARCH_SPEC #if DISABLE_MULTILIB #if DEFAULT_ARCH32_P #define LINK_ARCH_SPEC "\ -%{m32:-m elf32_sparc %(link_arch32)} \ +%{m32:-m " SPARC32_EMULATION " %(link_arch32)} \ %{m64:%edoes not support multilib} \ %{!m32:%{!m64:%(link_arch_default)}} \ " #else #define LINK_ARCH_SPEC "\ %{m32:%edoes not support multilib} \ -%{m64:-m elf64_sparc %(link_arch64)} \ +%{m64:-m " SPARC64_EMULATION " %(link_arch64)} \ %{!m32:%{!m64:%(link_arch_default)}} \ " #endif #else #define LINK_ARCH_SPEC "\ -%{m32:-m elf32_sparc %(link_arch32)} \ -%{m64:-m elf64_sparc %(link_arch64)} \ +%{m32:-m " SPARC32_EMULATION " %(link_arch32)} \ +%{m64:-m " SPARC64_EMULATION " %(link_arch64)} \ %{!m32:%{!m64:%(link_arch_default)}} \ " #endif diff --git a/gcc/configure b/gcc/configure index 33ac30edc7f..ea79930b808 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24893,6 +24893,36 @@ $as_echo "$as_me: WARNING: --build-id is not supported by your linker; --enable- fi fi +# In binutils 2.21, GNU ld gained support for new emulations fully +# supporting the Solaris 2 ABI. Detect their presence in the linker used. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker *_sol2 emulation support" >&5 +$as_echo_n "checking linker *_sol2 emulation support... " >&6; } +if test "${gcc_cv_ld_sol2_emulation+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_ld_sol2_emulation=no + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a \ + "$gcc_cv_gld_minor_version" -ge 21 -o \ + "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then + gcc_cv_ld_sol2_emulation=yes + fi + elif test x$gcc_cv_ld != x; then + if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \ + grep _sol2 > /dev/null; then + gcc_cv_ld_sol2_emulation=yes + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_sol2_emulation" >&5 +$as_echo "$gcc_cv_ld_sol2_emulation" >&6; } +if test x"$gcc_cv_ld_sol2_emulation" = xyes; then + +$as_echo "#define HAVE_LD_SOL2_EMULATION 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --sysroot support" >&5 $as_echo_n "checking linker --sysroot support... " >&6; } if test "${gcc_cv_ld_sysroot+set}" = set; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index 06770333a99..27cb45c9a9d 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4034,6 +4034,29 @@ if test x"$enable_linker_build_id" = xyes; then fi fi +# In binutils 2.21, GNU ld gained support for new emulations fully +# supporting the Solaris 2 ABI. Detect their presence in the linker used. +AC_CACHE_CHECK(linker *_sol2 emulation support, + gcc_cv_ld_sol2_emulation, + [gcc_cv_ld_sol2_emulation=no + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a \ + "$gcc_cv_gld_minor_version" -ge 21 -o \ + "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes; then + gcc_cv_ld_sol2_emulation=yes + fi + elif test x$gcc_cv_ld != x; then + if $gcc_cv_ld -V 2>/dev/null | sed -e '1,/Supported emulations/d;q' | \ + grep _sol2 > /dev/null; then + gcc_cv_ld_sol2_emulation=yes + fi + fi]) +if test x"$gcc_cv_ld_sol2_emulation" = xyes; then + AC_DEFINE(HAVE_LD_SOL2_EMULATION, 1, + [Define if your linker supports the *_sol2 emulations.]) +fi + AC_CACHE_CHECK(linker --sysroot support, gcc_cv_ld_sysroot, [gcc_cv_ld_sysroot=no -- 2.11.0