As reported in

        https://gcc.gnu.org/pipermail/gcc-patches/2026-March/709850.html

this patch

commit fdd1d058f289eda39b6eb1386a0dabef3478d298
Author: Rainer Orth <[email protected]>
Date:   Fri Feb 6 20:31:27 2026 +0100

    build: Properly set gas_flag/gnu_ld_flag

still causes testsuite regressions in some scenarious (a cross to
arm-none-eabi in this case).

Comparing gcc/auto-host.h before and after that patch shows that
HAVE_GNU_AS and HAVE_GNU_LD are mis-detected again:

@@ -1640 +1616 @@
-#define HAVE_GNU_AS 1
+#define HAVE_GNU_AS 0
@@ -1652 +1628 @@
-#define HAVE_GNU_LD 1
+#define HAVE_GNU_LD 0

Since

commit c807ac4d96dbb2e612fa2e8ebf7485b2fc3db117
Author: Rainer Orth <[email protected]>
Date:   Sun Mar 1 18:04:03 2026 +0100

    Switch to HAVE_SOLARIS_AS

and

commit 96f3b4dfe16984299d65d7a071a5586dafcbd046
Author: Rainer Orth <[email protected]>
Date:   Sun Mar 1 18:32:26 2026 +0100

    Switch to HAVE_SOLARIS_LD

this patch is no longer needed to avoid the HAVE_GNU_AS/HAVE_GNU_LD
misdetections on Solaris.  In fact, the few remaining uses of those
macros are expected to be removed in GCC 17 stage 1.

For the moment, I'd like to revert the patch above.

Bootstrapped without regressions no i386-pc-solaris2.11,
sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and by comparing auto-host.h
in make configure-gcc for a cross to arm-none-eabi.

Ok for trunk?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2026-03-06  Rainer Orth  <[email protected]>

        gcc:
        Revert:
        2026-02-04  Rainer Orth  <[email protected]>

        * configure.ac (gnu_ld_flag): Move $gcc_cv_ld --version check into
        AC_ARG_WITH(gnu-ld).
        (gcc_cv_ld): Set before gnu_ld_flag.
        (gas_flag): Move $gcc_cv_ld --version check into AC_ARG_WITH(gnu-ld).
        (gcc_cv_as): Set before gas_flag.
        * configure: Regenerate.

# HG changeset patch
# Parent  8c427762e8492d6882a84732a17cb1176149ee25
Revert "build: Properly set gas_flag/gnu_ld_flag" [PR??????]

diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -969,9 +969,11 @@ with_gxx_include_dir
 with_gxx_libcxx_include_dir
 with_cpp_install_dir
 enable_generated_files_in_srcdir
+with_gnu_ld
 with_ld
 with_demangler_in_ld
 with_dsymutil
+with_gnu_as
 with_as
 with_windres
 enable_largefile
@@ -1009,7 +1011,6 @@ with_picolibc
 with_zstd
 with_zstd_include
 with_zstd_lib
-with_gnu_ld
 enable_rpath
 with_libiconv_prefix
 with_libiconv_type
@@ -1032,7 +1033,6 @@ enable_fast_install
 enable_libtool_lock
 enable_darwin_at_rpath
 with_darwin_extra_rpath
-with_gnu_as
 enable_ld
 enable_gold
 with_plugin_ld
@@ -1868,10 +1868,12 @@ Optional Packages:
   --with-cpp-install-dir=DIR
                           install the user visible C preprocessor in DIR
                           (relative to PREFIX) as well as PREFIX/bin
+  --with-gnu-ld           arrange to work with GNU ld
   --with-ld               arrange to use the specified ld (full pathname)
   --with-demangler-in-ld  try to use demangler in GNU ld
   --with-dsymutil         arrange to use the specified dsymutil (full
                           pathname)
+  --with-gnu-as           arrange to work with GNU as
   --with-as               arrange to use the specified as (full pathname)
   --with-windres          arrange to use the specified windres (full pathname)
   --with-stack-clash-protection-guard-size=size
@@ -1919,8 +1921,6 @@ Optional Packages:
   --with-darwin-extra-rpath=[ARG]
                           Specify a runpath directory, additional to those
                           provided by the compiler
-  --with-gnu-as           arrange to work with GNU as
-  --with-gnu-ld           arrange to work with GNU ld
   --with-plugin-ld=[ARG]  specify the plugin linker
   --with-glibc-version=M.N
                           assume GCC used with glibc version M.N or later
@@ -3925,6 +3925,16 @@ fi
 # Find default linker
 # -------------------
 
+# With GNU ld
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; gnu_ld_flag="$with_gnu_ld"
+else
+  gnu_ld_flag=no
+fi
+
+
 case $target in
     *darwin*)
 	ld64_flag=yes # Darwin can only use a ld64-compatible linker.
@@ -4021,6 +4031,16 @@ fi
 # Find default assembler
 # ----------------------
 
+# With GNU as
+
+# Check whether --with-gnu-as was given.
+if test "${with_gnu_as+set}" = set; then :
+  withval=$with_gnu_as; gas_flag="$with_gnu_as"
+else
+  gas_flag=no
+fi
+
+
 
 # Check whether --with-as was given.
 if test "${with_as+set}" = set; then :
@@ -21953,7 +21973,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21956 "configure"
+#line 21976 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -22059,7 +22079,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 22062 "configure"
+#line 22082 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -25476,20 +25496,6 @@ fi
 fi
 fi
 
-# With GNU as
-
-# Check whether --with-gnu-as was given.
-if test "${with_gnu_as+set}" = set; then :
-  withval=$with_gnu_as; gas_flag="$with_gnu_as"
-else
-  if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
-   gas_flag=yes
- else
-   gas_flag=no
-fi
-fi
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Solaris assembler" >&5
 $as_echo_n "checking Solaris assembler... " >&6; }
 case $target in
@@ -25522,6 +25528,15 @@ case "$ORIGINAL_AS_FOR_TARGET" in
  ;;
 esac
 
+# Check if we are using GNU as if not already set.
+if test -z "$gas_flag"; then
+  if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
+    gas_flag=yes
+  else
+    gas_flag=no
+  fi
+fi
+
 if $gcc_cv_as --help 2>&1 | grep -- --fatal-warnings > /dev/null; then
   fw_as_opt=--fatal-warnings
 fi
@@ -25635,20 +25650,6 @@ fi
 fi
 fi
 
-# With GNU ld
-
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then :
-  withval=$with_gnu_ld; gnu_ld_flag="$with_gnu_ld"
-else
-  if $gcc_cv_ld --version 2>/dev/null | grep GNU > /dev/null; then
-   gnu_ld_flag=yes
- else
-   gnu_ld_flag=no
- fi
-fi
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Solaris linker" >&5
 $as_echo_n "checking Solaris linker... " >&6; }
 case $target in
@@ -25697,6 +25698,15 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Check if we are using GNU ld if not already set.
+if test -z "$gnu_ld_flag"; then
+  if $gcc_cv_ld --version 2>/dev/null | grep GNU > /dev/null; then
+    gnu_ld_flag=yes
+  else
+    gnu_ld_flag=no
+  fi
+fi
+
 case "$target:$gnu_ld_flag" in
   *-*-solaris2*:no)
     # While Solaris ld has -m32/-m64 it usually determines the ELF class
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -332,6 +332,12 @@ AC_SUBST(GENINSRC)
 # Find default linker
 # -------------------
 
+# With GNU ld
+AC_ARG_WITH(gnu-ld,
+[AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])],
+gnu_ld_flag="$with_gnu_ld",
+gnu_ld_flag=no)
+
 case $target in
     *darwin*)
 	ld64_flag=yes # Darwin can only use a ld64-compatible linker.
@@ -405,6 +411,12 @@ fi
 # Find default assembler
 # ----------------------
 
+# With GNU as
+AC_ARG_WITH(gnu-as,
+[AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])],
+gas_flag="$with_gnu_as",
+gas_flag=no)
+
 AC_ARG_WITH(as,
 [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])],
 DEFAULT_ASSEMBLER="$with_as")
@@ -2726,16 +2738,6 @@ else
         AC_PATH_PROG(gcc_cv_as, $AS_FOR_TARGET)
 fi])
 
-# With GNU as
-AC_ARG_WITH(gnu-as,
-[AS_HELP_STRING([--with-gnu-as], [arrange to work with GNU as])],
-gas_flag="$with_gnu_as",
-[if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
-   gas_flag=yes
- else
-   gas_flag=no
-fi])
-
 AC_MSG_CHECKING(Solaris assembler)
 case $target in
   *-*-solaris2*)
@@ -2762,6 +2764,15 @@ case "$ORIGINAL_AS_FOR_TARGET" in
   *) AC_CONFIG_FILES(as:exec-tool.in, [chmod +x as]) ;;
 esac 
 
+# Check if we are using GNU as if not already set.
+if test -z "$gas_flag"; then
+  if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
+    gas_flag=yes
+  else
+    gas_flag=no
+  fi
+fi
+
 if $gcc_cv_as --help 2>&1 | grep -- --fatal-warnings > /dev/null; then
   fw_as_opt=--fatal-warnings
 fi
@@ -2828,16 +2839,6 @@ else
         AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
 fi])
 
-# With GNU ld
-AC_ARG_WITH(gnu-ld,
-[AS_HELP_STRING([--with-gnu-ld], [arrange to work with GNU ld])],
-gnu_ld_flag="$with_gnu_ld",
-[if $gcc_cv_ld --version 2>/dev/null | grep GNU > /dev/null; then
-   gnu_ld_flag=yes
- else
-   gnu_ld_flag=no
- fi])
-
 AC_MSG_CHECKING(Solaris linker)
 case $target in
   *-*-solaris2*)
@@ -2874,6 +2875,15 @@ AC_ARG_WITH(plugin-ld,
 AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET)
 AC_DEFINE_UNQUOTED(PLUGIN_LD_SUFFIX, "$PLUGIN_LD_SUFFIX", [Specify plugin linker])
 
+# Check if we are using GNU ld if not already set.
+if test -z "$gnu_ld_flag"; then
+  if $gcc_cv_ld --version 2>/dev/null | grep GNU > /dev/null; then
+    gnu_ld_flag=yes
+  else
+    gnu_ld_flag=no
+  fi
+fi
+
 case "$target:$gnu_ld_flag" in
   *-*-solaris2*:no)
     # While Solaris ld has -m32/-m64 it usually determines the ELF class

Reply via email to