[binutils-gdb] ld: Force SHELL=/bin/bash in ld for Solaris [PR32580]
Rainer Orth
ro@sourceware.org
Fri Jul 25 07:49:47 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=96ad2fd3c0c0414110fe58ed4ee511f49768fa3d
commit 96ad2fd3c0c0414110fe58ed4ee511f49768fa3d
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Fri Jul 25 09:49:13 2025 +0200
ld: Force SHELL=/bin/bash in ld for Solaris [PR32580]
As described in PR ld/32580, when using SHELL=/bin/sh or /bin/ksh on
Solaris, the generated linker scripts get corrupted. So far, the only
workaround is to enforce /bin/bash instead.
This is a major nuisance for developers and users alike, so this patch
automates this by overriding SHELL in ld/configure.ac.
Tested on amd64-pc-solaris2.11 in three configurations:
* CONFIG_SHELL unset
* CONFIG_SHELL=/bin/ksh
* CONFIG_SHELL='/bin/bash --norc'
In the first two cases, SHELL was set to /bin/bash as desired, while in
the third it was left unchanged.
2025-07-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
ld:
PR ld/32580
* configure.ac <*-*-solaris2*>: Enforce SHELL=/bin/bash.
* configure: Regenerate.
Diff:
---
ld/ChangeLog | 6 ++++++
ld/configure | 17 +++++++++++++++--
ld/configure.ac | 13 +++++++++++++
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 52bbeda444b..96960ab08e0 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2025-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR ld/32580
+ * configure.ac <*-*-solaris2*>: Enforce SHELL=/bin/bash.
+ * configure: Regenerate.
+
2025-07-13 Nick Clifton <nickc@redhat.com>
* 2.45 Branch point.
diff --git a/ld/configure b/ld/configure
index 015666d30a6..124b44182bc 100755
--- a/ld/configure
+++ b/ld/configure
@@ -3362,6 +3362,19 @@ fi
+case $target in
+ *-*-solaris2*)
+ case "$SHELL" in
+ *bash*)
+ ;;
+ *)
+ # PR 32580: Force use of bash to avoid corrupt linker scripts.
+ SHELL=/bin/bash
+ ;;
+ esac
+ ;;
+esac
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -11501,7 +11514,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11504 "configure"
+#line 11517 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11607,7 +11620,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11610 "configure"
+#line 11623 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/ld/configure.ac b/ld/configure.ac
index af065fe7d4f..e306c1ded4a 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -28,6 +28,19 @@ AM_INIT_AUTOMAKE
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE
+case $target in
+ *-*-solaris2*)
+ case "$SHELL" in
+ *bash*)
+ ;;
+ *)
+ # PR 32580: Force use of bash to avoid corrupt linker scripts.
+ SHELL=/bin/bash
+ ;;
+ esac
+ ;;
+esac
+
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GREP
More information about the Binutils-cvs
mailing list