https://gcc.gnu.org/g:5afd19be0d7b7d781522538187619b625d0a390e

commit r16-5272-g5afd19be0d7b7d781522538187619b625d0a390e
Author: Rainer Orth <[email protected]>
Date:   Fri Nov 14 09:12:34 2025 +0100

    build: Require binutils 2.30+ on Solaris [PR121457, PR121458]
    
    I recently noticed that gcc/configure.ac contains quite a number of
    checks for Solaris ld and GNU ld versions that can be massively
    simplified.  GCC trunk only supports Solaris 11.4, thus Solaris ld is at
    least at version 5.11-1.3159 (the one in 11.4 FCS), and GNU ld can be
    required to be at least 2.30.1, the version bundled in 11.4 FCS.
    
    This way quite a number of special cases can simply be removed, as well
    as some macros that depend on them and the code they guard.
    
    To ensure that nobody tries to use an older self-compiled version of GNU
    ld, the minimum version is checked at configure time.
    
    This change also allowed to fix two bugs that were caused by checks for
    *_sol2 among the linker emulations listed by gld -V, which are only valid
    when targetting Solaris.  Before those checks were done irrespective of
    target, causing checks to go wrong when a version of binutils configured
    with --enable-targets=all was used.  Since now all versions of GNU ld
    supported on Solaris are known to support those *_sol2 emulations, the
    checks can be replaced by hardcoding the emulations when targetting
    Solaris.
    
    Bootstrapped without regressions on i386-pc-solaris2.11,
    sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.
    
    2025-09-22  Rainer Orth  <[email protected]>
    
            gcc:
            PR target/121458
            PR target/121457
            * configure.ac: Fix typos.
            <*-*-solaris2*>: Require GNU ld 2.30.
            (comdat_group) <*-*-solaris2.1[1-9]*>: Always set to yes.
            (ld_ix86_gld_32_opt): Only use -melf_i386_sol2 for Solaris target.
            (ld_ix86_gld_64_opt): Likewise with -melf_x86_64_sol.
            (gcc_cv_ld_eh_frame_hdr) <*-*-solaris2*>: Likewise.
            (gcc_cv_ld_pie) <*-*-solaris2*>: Remove special cases.
            (gcc_cv_ld_compress_debug) <*-*-solaris2*>: Remove guard.
            (gcc_cv_ld_as_needed): Simplify guard.
            (gcc_cv_ld_sol2_emulation): Remove.
            (gcc_cv_solaris_crts): Remove.
            * configure: Regenerate.
            * config.in: Regenerate.
    
            * config/sol2.h (STARTFILE_CRTBEGIN_SPEC): Remove !HAVE_LD_PIE
            support.
            (ENDFILE_CRTEND_SPEC): Likewise.
            (LD_PIE_SPEC): Likewise.
            [USE_GLD] (LINK_EH_SPEC): Set unconditionally.
            * config/i386/sol2.h [USE_GLD]: Remove !HAVE_LD_SOL2_EMULATION
            support.
            * config/sparc/sol2.h: Likewise.
    
            * doc/install.texi (Specific, *-*-solaris2*): Update bundled gcc
            versions.
            Raise required binutils version.
            Remove binutils 2.44 caveat.

Diff:
---
 gcc/config.in           |  12 ----
 gcc/config/i386/sol2.h  |   7 --
 gcc/config/sol2.h       |  16 -----
 gcc/config/sparc/sol2.h |   7 --
 gcc/configure           | 178 +++++++++++-------------------------------------
 gcc/configure.ac        | 166 +++++++++++---------------------------------
 gcc/doc/install.texi    |  14 ++--
 7 files changed, 84 insertions(+), 316 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index e67936bfe9ad..7101286a9fb1 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1888,12 +1888,6 @@
 #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 or equivalent options. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_LD_STATIC_DYNAMIC
@@ -2075,12 +2069,6 @@
 #endif
 
 
-/* Define if the system-provided CRTs are present on Solaris. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_SOLARIS_CRTS
-#endif
-
-
 /* Define to 1 if you have the <stddef.h> header file. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_STDDEF_H
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index 013e87f72a3a..90355e853eed 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -91,15 +91,8 @@ along with GCC; see the file COPYING3.  If not see
 #define ARCH64_SUBDIR "amd64"
 
 #ifdef USE_GLD
-/* 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 ARCH32_EMULATION "elf_i386_sol2"
 #define ARCH64_EMULATION "elf_x86_64_sol2"
-#else
-#define ARCH32_EMULATION "elf_i386"
-#define ARCH64_EMULATION "elf_x86_64"
-#endif
 #endif
 
 #define ENDFILE_ARCH_SPEC \
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 2405c101aee3..2f5ead99a361 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -199,13 +199,9 @@ along with GCC; see the file COPYING3.  If not see
      %{ansi|std=c*|std=iso9899\\:199409:values-Xc.o%s; :values-Xa.o%s} \
      %{std=c90|std=gnu90:values-xpg4.o%s; :values-xpg6.o%s}}}"
 
-#if defined(HAVE_LD_PIE)
 #define STARTFILE_CRTBEGIN_SPEC "%{static:crtbegin.o%s; \
                                   shared|" PIE_SPEC ":crtbeginS.o%s; \
                                   :crtbegin.o%s}"
-#else
-#define STARTFILE_CRTBEGIN_SPEC        "crtbegin.o%s"
-#endif
 
 #if ENABLE_VTABLE_VERIFY
 #if SUPPORTS_INIT_PRIORITY
@@ -270,13 +266,9 @@ along with GCC; see the file COPYING3.  If not see
                        crti.o%s %(startfile_arch) %(startfile_crtbegin) \
                        %(startfile_vtv)"
 
-#if defined(HAVE_LD_PIE)
 #define ENDFILE_CRTEND_SPEC "%{static:crtend.o%s; \
                               shared|" PIE_SPEC ":crtendS.o%s; \
                               :crtend.o%s}"
-#else
-#define ENDFILE_CRTEND_SPEC "crtend.o%s"
-#endif
 
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
@@ -414,12 +406,9 @@ along with GCC; see the file COPYING3.  If not see
 
 #ifdef USE_GLD
 /* GNU ld needs --eh-frame-hdr to create the required .eh_frame_hdr sections.  
*/
-#if defined(HAVE_LD_EH_FRAME_HDR)
 #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
-#endif /* HAVE_LD_EH_FRAME */
 #endif
 
-#if defined(HAVE_LD_PIE)
 #ifdef USE_GLD
 /* Assert -z text by default to match Solaris ld.  */
 #define LD_PIE_SPEC "-pie %{!mimpure-text:-z text}"
@@ -427,11 +416,6 @@ along with GCC; see the file COPYING3.  If not see
 /* Solaris ld needs -z type=pie instead of -pie.  */
 #define LD_PIE_SPEC "-z type=pie %{mimpure-text:-z textoff}"
 #endif
-#else
-/* Error out if some part of PIE support is missing.  */
-#define LINK_PIE_SPEC \
-  "%{no-pie:} %{pie:%e-pie is not supported in this configuration} "
-#endif
 
 /* collect2.cc can only parse GNU nm -n output.  Solaris nm needs -png to
    produce the same format.  */
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
index 03a19bfa5f7e..71ac0664e36b 100644
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -308,15 +308,8 @@ extern const char *host_detect_local_cpu (int argc, const 
char **argv);
 "
 
 #ifdef USE_GLD
-/* 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 ARCH32_EMULATION "elf32_sparc_sol2"
 #define ARCH64_EMULATION "elf64_sparc_sol2"
-#else
-#define ARCH32_EMULATION "elf32_sparc"
-#define ARCH64_EMULATION "elf64_sparc"
-#endif
 #endif
 
 #define ARCH64_SUBDIR "sparcv9"
diff --git a/gcc/configure b/gcc/configure
index 9d68bcd97a94..0e8a63c34fa7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -26472,6 +26472,17 @@ if test $in_tree_ld != yes ; then
     ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
     ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
     ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+    case "${target}" in
+      *-*-solaris2*)
+       if test "$ld_vers_major" -gt 2; then
+         :
+       elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 30; then
+         :
+       else
+         as_fn_error $? "GNU ld 2.30 or later is required on Solaris (found 
GNU ld $ld_ver)" "$LINENO" 5
+       fi
+       ;;
+    esac
   else
     case "${target}" in
       *-*-solaris2*)
@@ -27368,9 +27379,9 @@ _ACEOF
 # Test if the assembler supports the section flag 'R' for specifying
 # section with SHF_GNU_RETAIN.
 case "${target}" in
-  # Solaris may use GNU assembler with Solairs ld.  Even if GNU
+  # Solaris may use GNU assembler with Solaris ld.  Even if GNU
   # assembler supports the section flag 'R', it doesn't mean that
-  # Solairs ld supports it.
+  # Solaris ld supports it.
   *-*-solaris2*)
     gcc_cv_as_shf_gnu_retain=no
     ;;
@@ -27414,9 +27425,9 @@ _ACEOF
 # Test if the assembler supports the section flag 'o' for specifying
 # section with link-order.
 case "${target}" in
-  # Solaris may use GNU assembler with Solairs ld.  Even if GNU
+  # Solaris may use GNU assembler with Solaris ld.  Even if GNU
   # assembler supports the section flag 'o', it doesn't mean that
-  # Solairs ld supports it.
+  # Solaris ld supports it.
   *-*-solaris2*)
     gcc_cv_as_section_link_order=no
     ;;
@@ -27662,21 +27673,8 @@ elif echo "$ld_ver" | grep GNU > /dev/null; then
   fi
 else
   case "${target}" in
-    *-*-solaris2.1[1-9]*)
-      comdat_group=no
-      # Sun ld has COMDAT group support since Solaris 9, but it doesn't
-      # interoperate with GNU as until Solaris 11 build 130, i.e. ld
-      # version 1.688.
-      #
-      # If using Sun as for COMDAT group as emitted by GCC, one needs at
-      # least ld version 1.2267.
-      if test "$ld_vers_major" -gt 1; then
-        comdat_group=yes
-      elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
-       comdat_group=yes
-      elif test "$ld_vers_minor" -ge 2267; then
-       comdat_group=yes
-      fi
+    *-*-solaris2*)
+      comdat_group=yes
       ;;
     *)
       # Assume linkers other than GNU ld don't support COMDAT group.
@@ -30080,12 +30078,11 @@ fi
     if test x$gas = xyes; then
       as_ix86_gas_32_opt="--32"
     fi
-    if echo "$ld_ver" | grep GNU > /dev/null; then
-      if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
-        ld_ix86_gld_32_opt="-melf_i386_sol2"
-      else
-        ld_ix86_gld_32_opt="-melf_i386"
-      fi
+    if test x$gnu_ld = xyes; then
+      case $target in
+       *-*-solaris2*) ld_ix86_gld_32_opt="-melf_i386_sol2" ;;
+       *)             ld_ix86_gld_32_opt="-melf_i386" ;;
+      esac
     fi
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for 
R_386_TLS_GD_PLT reloc" >&5
@@ -30274,12 +30271,11 @@ _ACEOF
 
     # Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15"
     # with R_X86_64_CODE_6_GOTTPOFF relocation.
-    if echo "$ld_ver" | grep GNU > /dev/null; then
-      if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then
-        ld_ix86_gld_64_opt="-melf_x86_64_sol2"
-      else
-        ld_ix86_gld_64_opt="-melf_x86_64"
-      fi
+    if test x$gnu_ld = xyes; then
+      case $target in
+       *-*-solaris2*) ld_ix86_gld_64_opt="-melf_x86_64_sol2" ;;
+       *)             ld_ix86_gld_64_opt="-melf_x86_64" ;;
+      esac
     fi
     # Enforce 64-bit output with gas and gld.
     if test x$gas = xyes; then
@@ -32865,10 +32861,7 @@ elif test x$gcc_cv_ld != x; then
   else
     case "$target" in
       *-*-solaris2*)
-        # Sun ld has various bugs in .eh_frame_hdr support before version 
1.2251.
-        if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
-          gcc_cv_ld_eh_frame_hdr=yes
-        fi
+       gcc_cv_ld_eh_frame_hdr=yes
         ;;
     esac
   fi
@@ -32886,11 +32879,7 @@ $as_echo "$gcc_cv_ld_eh_frame_hdr" >&6; }
 $as_echo_n "checking linker position independent executable support... " >&6; }
 gcc_cv_ld_pie=no
 if test $in_tree_ld = yes ; then
-  case "$target" in
-    # Full PIE support on Solaris was only introduced in gld 2.26.
-    *-*-solaris2*)  gcc_gld_pie_min_version=26 ;;
-    *)                     gcc_gld_pie_min_version=15 ;;
-  esac
+  gcc_gld_pie_min_version=15
   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 
"$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \
      && test $in_tree_ld_is_elf = yes; then
     gcc_cv_ld_pie=yes
@@ -32899,21 +32888,11 @@ elif test x$gcc_cv_ld != x; then
   # Check if linker supports -pie option
   if $gcc_cv_ld --help 2>&1 | grep -- -pie > /dev/null; then
     gcc_cv_ld_pie=yes
-    case "$target" in
-      *-*-solaris2*)
-       if echo "$ld_ver" | grep GNU > /dev/null \
-         && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then
-         gcc_cv_ld_pie=no
-       fi
-       ;;
-    esac
   else
     case "$target" in
-      *-*-solaris2.1[1-9]*)
+      *-*-solaris2*)
        # Solaris 11.3 added PIE support.
-       if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
-         gcc_cv_ld_pie=yes
-       fi
+       gcc_cv_ld_pie=yes
        ;;
     esac
   fi
@@ -33122,12 +33101,8 @@ else
   case "${target}" in
     *-*-solaris2*)
       # Introduced in Solaris 11.2.
-      if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; 
then
-        gcc_cv_ld_compress_debug=1
-        gcc_cv_ld_compress_debug_option="-z compress-sections"
-      else
-        gcc_cv_ld_compress_debug=0
-      fi
+      gcc_cv_ld_compress_debug=1
+      gcc_cv_ld_compress_debug_option="-z compress-sections"
       ;;
     *)
       # Assume linkers other than GNU ld don't support compessed debug
@@ -33430,21 +33405,12 @@ elif test x$gcc_cv_ld != x; then
       ;;
   esac
 fi
-# --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
-# dl_iterate_phdr, i.e. since Solaris 11.
 case "$target" in
-  *-*-solaris2.1[1-9]*)
-    case "$target" in
-    i?86-*-* | x86_64-*-*)
-      if echo "$ld_ver" | grep GNU > /dev/null; then
-        # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
-        gcc_cv_ld_as_needed=no
-      fi
-      ;;
-    esac
-    ;;
-  *-*-solaris2*)
-    gcc_cv_ld_as_needed=no
+  i?86-*-solaris2* | x86_64-*-solaris2*)
+    if echo "$ld_ver" | grep GNU > /dev/null; then
+      # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
+      gcc_cv_ld_as_needed=no
+    fi
     ;;
 esac
 
@@ -33766,36 +33732,6 @@ $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 ${gcc_cv_ld_sol2_emulation+:} false; 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 ${gcc_cv_ld_sysroot+:} false; then :
@@ -33820,44 +33756,6 @@ $as_echo "#define HAVE_LD_SYSROOT 1" >>confdefs.h
 
 fi
 
-case $target in
-*-*-solaris2*)
-  # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking system-provided CRTs on 
Solaris" >&5
-$as_echo_n "checking system-provided CRTs on Solaris... " >&6; }
-if ${gcc_cv_solaris_crts+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  gcc_cv_solaris_crts=no
-     if test x$host != x$target; then
-       if test "x$with_sysroot" = xyes; then
-         target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
-       else
-         target_sysroot="${with_sysroot}"
-       fi
-     fi
-     target_libdir="$target_sysroot/usr/lib"
-     # At the time they were added, gcrt1.o became a symlink for backwards
-     # compatibility on x86, while crt1.o was added on sparc, so check for 
that.
-     case $target in
-       i?86-*-solaris2* | x86_64-*-solaris2*)
-         if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
-        ;;
-       sparc*-*-solaris2*)
-         if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
-        ;;
-     esac
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_solaris_crts" >&5
-$as_echo "$gcc_cv_solaris_crts" >&6; }
-  ;;
-esac
-if test x$gcc_cv_solaris_crts = xyes; then
-
-$as_echo "#define HAVE_SOLARIS_CRTS 1" >>confdefs.h
-
-fi
-
 # Check whether --enable-libssp was given.
 if test "${enable_libssp+set}" = set; then :
   enableval=$enable_libssp; case "${enableval}" in
diff --git a/gcc/configure.ac b/gcc/configure.ac
index dbc216bfabb0..a3243256af09 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3166,6 +3166,19 @@ if test $in_tree_ld != yes ; then
     ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
     ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
     ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+    case "${target}" in
+      *-*-solaris2*)
+       if test "$ld_vers_major" -gt 2; then
+         :
+       elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 30; then
+         :
+       else
+changequote([,])dnl
+         AC_MSG_ERROR([GNU ld 2.30 or later is required on Solaris (found GNU 
ld $ld_ver)])
+changequote(,)dnl
+       fi
+       ;;
+    esac
   else
     case "${target}" in
       *-*-solaris2*)
@@ -3587,9 +3600,9 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SECTION_EXCLUDE,
 # Test if the assembler supports the section flag 'R' for specifying
 # section with SHF_GNU_RETAIN.
 case "${target}" in
-  # Solaris may use GNU assembler with Solairs ld.  Even if GNU
+  # Solaris may use GNU assembler with Solaris ld.  Even if GNU
   # assembler supports the section flag 'R', it doesn't mean that
-  # Solairs ld supports it.
+  # Solaris ld supports it.
   *-*-solaris2*)
     gcc_cv_as_shf_gnu_retain=no
     ;;
@@ -3607,9 +3620,9 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_GNU_RETAIN,
 # Test if the assembler supports the section flag 'o' for specifying
 # section with link-order.
 case "${target}" in
-  # Solaris may use GNU assembler with Solairs ld.  Even if GNU
+  # Solaris may use GNU assembler with Solaris ld.  Even if GNU
   # assembler supports the section flag 'o', it doesn't mean that
-  # Solairs ld supports it.
+  # Solaris ld supports it.
   *-*-solaris2*)
     gcc_cv_as_section_link_order=no
     ;;
@@ -3711,21 +3724,8 @@ elif echo "$ld_ver" | grep GNU > /dev/null; then
 else
 changequote(,)dnl
   case "${target}" in
-    *-*-solaris2.1[1-9]*)
-      comdat_group=no
-      # Sun ld has COMDAT group support since Solaris 9, but it doesn't
-      # interoperate with GNU as until Solaris 11 build 130, i.e. ld
-      # version 1.688.
-      #
-      # If using Sun as for COMDAT group as emitted by GCC, one needs at
-      # least ld version 1.2267.
-      if test "$ld_vers_major" -gt 1; then
-        comdat_group=yes
-      elif test "x$gas_flag" = xyes && test "$ld_vers_minor" -ge 1688; then
-       comdat_group=yes
-      elif test "$ld_vers_minor" -ge 2267; then
-       comdat_group=yes
-      fi
+    *-*-solaris2*)
+      comdat_group=yes
       ;;
     *)
       # Assume linkers other than GNU ld don't support COMDAT group.
@@ -5002,12 +5002,11 @@ foo:    nop
     if test x$gas = xyes; then
       as_ix86_gas_32_opt="--32"
     fi
-    if echo "$ld_ver" | grep GNU > /dev/null; then
-      if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
-        ld_ix86_gld_32_opt="-melf_i386_sol2"
-      else
-        ld_ix86_gld_32_opt="-melf_i386"
-      fi
+    if test x$gnu_ld = xyes; then
+      case $target in
+       *-*-solaris2*) ld_ix86_gld_32_opt="-melf_i386_sol2" ;;
+       *)             ld_ix86_gld_32_opt="-melf_i386" ;;
+      esac
     fi
 
     gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
@@ -5100,12 +5099,11 @@ _start:
 
     # Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15"
     # with R_X86_64_CODE_6_GOTTPOFF relocation.
-    if echo "$ld_ver" | grep GNU > /dev/null; then
-      if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then
-        ld_ix86_gld_64_opt="-melf_x86_64_sol2"
-      else
-        ld_ix86_gld_64_opt="-melf_x86_64"
-      fi
+    if test x$gnu_ld = xyes; then
+      case $target in
+       *-*-solaris2*) ld_ix86_gld_64_opt="-melf_x86_64_sol2" ;;
+       *)             ld_ix86_gld_64_opt="-melf_x86_64" ;;
+      esac
     fi
     # Enforce 64-bit output with gas and gld.
     if test x$gas = xyes; then
@@ -6148,10 +6146,7 @@ elif test x$gcc_cv_ld != x; then
   else
     case "$target" in
       *-*-solaris2*)
-        # Sun ld has various bugs in .eh_frame_hdr support before version 
1.2251.
-        if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2251; then
-          gcc_cv_ld_eh_frame_hdr=yes
-        fi
+       gcc_cv_ld_eh_frame_hdr=yes
         ;;
     esac
   fi
@@ -6166,11 +6161,7 @@ AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr)
 AC_MSG_CHECKING(linker position independent executable support)
 gcc_cv_ld_pie=no
 if test $in_tree_ld = yes ; then
-  case "$target" in
-    # Full PIE support on Solaris was only introduced in gld 2.26.
-    *-*-solaris2*)  gcc_gld_pie_min_version=26 ;;
-    *)                     gcc_gld_pie_min_version=15 ;;
-  esac
+  gcc_gld_pie_min_version=15
   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 
"$gcc_gld_pie_min_version" -o "$gcc_cv_gld_major_version" -gt 2 \
      && test $in_tree_ld_is_elf = yes; then
     gcc_cv_ld_pie=yes
@@ -6179,21 +6170,11 @@ elif test x$gcc_cv_ld != x; then
   # Check if linker supports -pie option
   if $gcc_cv_ld --help 2>&1 | grep -- -pie > /dev/null; then
     gcc_cv_ld_pie=yes
-    case "$target" in
-      *-*-solaris2*)
-       if echo "$ld_ver" | grep GNU > /dev/null \
-         && test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then
-         gcc_cv_ld_pie=no
-       fi
-       ;;
-    esac
   else
     case "$target" in
-      *-*-solaris2.1[[1-9]]*)
+      *-*-solaris2*)
        # Solaris 11.3 added PIE support.
-       if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
-         gcc_cv_ld_pie=yes
-       fi
+       gcc_cv_ld_pie=yes
        ;;
     esac
   fi
@@ -6392,12 +6373,8 @@ changequote(,)dnl
   case "${target}" in
     *-*-solaris2*)
       # Introduced in Solaris 11.2.
-      if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections' > /dev/null; 
then
-        gcc_cv_ld_compress_debug=1
-        gcc_cv_ld_compress_debug_option="-z compress-sections"
-      else
-        gcc_cv_ld_compress_debug=0
-      fi
+      gcc_cv_ld_compress_debug=1
+      gcc_cv_ld_compress_debug_option="-z compress-sections"
       ;;
     *)
       # Assume linkers other than GNU ld don't support compessed debug
@@ -6647,21 +6624,12 @@ elif test x$gcc_cv_ld != x; then
       ;;
   esac
 fi
-# --as-needed/-z ignore can only be used if libgcc_s.so.1 uses
-# dl_iterate_phdr, i.e. since Solaris 11.
 case "$target" in
-  *-*-solaris2.1[[1-9]]*)
-    case "$target" in
-    i?86-*-* | x86_64-*-*)
-      if echo "$ld_ver" | grep GNU > /dev/null; then
-        # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
-        gcc_cv_ld_as_needed=no
-      fi
-      ;;
-    esac
-    ;;
-  *-*-solaris2*)
-    gcc_cv_ld_as_needed=no
+  i?86-*-solaris2* | x86_64-*-solaris2*)
+    if echo "$ld_ver" | grep GNU > /dev/null; then
+      # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
+      gcc_cv_ld_as_needed=no
+    fi
     ;;
 esac
 ])
@@ -6912,29 +6880,6 @@ 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
@@ -6952,37 +6897,6 @@ if test x"$gcc_cv_ld_sysroot" = xyes; then
   [Define if your linker supports --sysroot.])
 fi       
 
-case $target in
-*-*-solaris2*)
-  # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
-  AC_CACHE_CHECK([system-provided CRTs on Solaris],
-    gcc_cv_solaris_crts,
-    [gcc_cv_solaris_crts=no
-     if test x$host != x$target; then
-       if test "x$with_sysroot" = xyes; then
-         target_sysroot="${test_exec_prefix}/${target_noncanonical}/sys-root"
-       else
-         target_sysroot="${with_sysroot}"
-       fi
-     fi
-     target_libdir="$target_sysroot/usr/lib"
-     # At the time they were added, gcrt1.o became a symlink for backwards
-     # compatibility on x86, while crt1.o was added on sparc, so check for 
that.
-     case $target in
-       i?86-*-solaris2* | x86_64-*-solaris2*)
-         if test -h "$target_libdir/gcrt1.o"; then gcc_cv_solaris_crts=yes; fi
-        ;;
-       sparc*-*-solaris2*)
-         if test -f "$target_libdir/crt1.o"; then gcc_cv_solaris_crts=yes; fi
-        ;;
-     esac])
-  ;;
-esac
-if test x$gcc_cv_solaris_crts = xyes; then
-  AC_DEFINE(HAVE_SOLARIS_CRTS, 1,
-           [Define if the system-provided CRTs are present on Solaris.])
-fi
-
 AC_ARG_ENABLE(libssp,
 [AS_HELP_STRING([--enable-libssp], [enable linking against libssp])],
 [case "${enableval}" in
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index acde0375fba7..437e4636db33 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -4921,7 +4921,7 @@ Support for Solaris 10 has been removed in GCC 10.  
Support for Solaris
 9 has been removed in GCC 5.  Support for Solaris 8 has been removed in
 GCC 4.8.  Support for Solaris 7 has been removed in GCC 4.6.
 
-Solaris 11.4 provides one or more of GCC 5, 7, 9, 10, 11, 12, 13, and 14.
+Solaris 11.4 provides one or more of GCC 5, 7, 9, 10, 11, 12, 13, 14,and 15.
 
 You need to install the @code{system/header}, @code{system/linker}, and
 @code{developer/assembler} packages.
@@ -4942,8 +4942,9 @@ conjunction with the Solaris linker.
 
 The GNU @command{as} versions included in Solaris 11.4, from GNU
 binutils 2.30.1 or newer (in @file{/usr/bin/gas} and
-@file{/usr/gnu/bin/as}), are known to work.  The version from GNU
-binutils 2.44 is known to work as well.  Recent versions of the Solaris
+@file{/usr/gnu/bin/as}), are known to work.  This is the minimum
+supported version.  The version from GNU
+binutils 2.45 is known to work as well.  Recent versions of the Solaris
 assembler in @file{/usr/bin/as} work almost as well, though.  To use GNU
 @command{as}, configure with the options @option{--with-gnu-as
 --with-as=@//usr/@/gnu/@/bin/@/as}.
@@ -4953,10 +4954,7 @@ GNU linker instead, the version in Solaris 11.4, from 
GNU Binutils
 2.30.1 or newer (in @file{/usr/gnu/bin/ld} and @file{/usr/bin/gld}),
 works.  However, it
 generally lacks platform specific features, so better stay with Solaris
-@command{ld}.  When using the version from GNU Binutils 2.44, there's
-an important caveat: binutils @emph{must} be configured with
-@code{CONFIG_SHELL=/bin/bash}, otherwise the linker's built-in linker
-scripts get corrupted on x86.  To use the LTO linker plugin
+@command{ld}.  To use the LTO linker plugin
 (@option{-fuse-linker-plugin}) with GNU @command{ld}, GNU Binutils
 @emph{must} be configured with @option{--enable-largefile}.  To use
 Solaris @command{ld}, we recommend to configure with
@@ -4978,7 +4976,7 @@ will be disabled if no appropriate version is found.  
Solaris
 work.
 
 In order to build the GNU Ada compiler, GNAT, a working GNAT is needed.
-Since Solaris 11.4 SRU 39, GNAT 11, 12, 13 or 14 is bundled in the
+Since Solaris 11.4 SRU 39, GNAT 11, 12, 13, 14, or 15 is bundled in the
 @code{developer/gcc/gcc-gnat} package.
 
 In order to build the GNU D compiler, GDC, a working @samp{libphobos} is

Reply via email to