https://gcc.gnu.org/g:14a3c867601a65fc306ec4ed2892b50638f795d0

commit r16-7833-g14a3c867601a65fc306ec4ed2892b50638f795d0
Author: Rainer Orth <[email protected]>
Date:   Sun Mar 1 21:16:33 2026 +0100

    Remove gld --as-needed workaround on Solaris/x86 [PR57261]
    
    When configured to use gld, gcc has disabled the --as-needed option
    as a workaround for binutils PR ld/12320:
    
            [build] Fix Solaris --as-needed/-z ignore detection (PR 
target/57261)
            https://gcc.gnu.org/legacy-ml/gcc-patches/2013-05/msg00698.html
    
    gld would add an unnecessary dependency on libgcc_s.so.1 even though
    --as-needed was used.
    
    Back then, libgcc_s.so.1 wasn't bundled with Solaris, so even trivial
    programs would fail to run unless linked with -R <libdir>.
    
    This workaround is no longer necessary for several reasons:
    
    * In Solaris 11, libgcc_s.so.1 is bundled, so there won't be runtime
      failures.
    
    * Although the problem occured more often on x86, Solaris/SPARC is
      affected just the same.  Nonetheless the workaround isn't used there.
    
    * The gld bug has finally been fixed for binutils 2.47, so the issue is
      going to vanish soon.
    
    Therefore this patch removes the workaround, bringing x86 en par with
    SPARC.
    
    Bootstrapped without regressions on i386-pc-solaris2.11,
    amd64-pc-solaris2.11, and x86_64-pc-linux-gnu.
    
    2026-02-21  Rainer Orth  <[email protected]>
    
            gcc:
            PR target/57261
            * configure.ac (gcc_cv_ld_as_needed) <i?86-*-solaris2* |
            x86_64-*-solaris2*>: Don't disable.
            * configure: Regenerate.

Diff:
---
 gcc/configure    | 9 ---------
 gcc/configure.ac | 9 ---------
 2 files changed, 18 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 81bb8ed38415..a344e11b912c 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -33268,15 +33268,6 @@ elif test x$gcc_cv_ld != x; then
       ;;
   esac
 fi
-case "$target" in
-  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
-      gcc_cv_ld_use_as_needed_ldscript=no
-    fi
-    ;;
-esac
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_as_needed" >&5
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c641d2f9af3c..d12382d2fa3d 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6581,15 +6581,6 @@ elif test x$gcc_cv_ld != x; then
       ;;
   esac
 fi
-case "$target" in
-  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
-      gcc_cv_ld_use_as_needed_ldscript=no
-    fi
-    ;;
-esac
 ])
 if test x"$gcc_cv_ld_as_needed" = xyes; then
        AC_DEFINE(HAVE_LD_AS_NEEDED, 1,

Reply via email to