From c31ce49786b85a515d5d1dcb5f25e7076e28a072 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 18 Mar 2026 08:41:13 +0100 Subject: [PATCH] onfigure: Partial fix for the {gas,gnu_ld}{,_flag} breakage [PR124547] Here is a partial fix for the PR124547 breakages. Setting {gas,gnu_ld}_flag to no when user didn't specify any of --with{,out}-gnu-{as,ld} nor --with-gnu-{as,ld}={yes,no} seems wrong when we want to later override it based on # 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 or # 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 So, this patch unsets it if not explicitly specified so that the later overriding works. On x86_64-linux it restores the auto-host.h and Makefile differences: -LD_VERSION_SCRIPT_OPTION = -LD_SONAME_OPTION = +LD_VERSION_SCRIPT_OPTION = --version-script +LD_SONAME_OPTION = -soname and -#define HAVE_AS_IX86_GOT32X 0 +#define HAVE_AS_IX86_GOT32X 1 #endif -#define HAVE_AS_IX86_TLSLDM 0 +#define HAVE_AS_IX86_TLSLDM 1 -#define HAVE_AS_IX86_TLS_GET_ADDR_GOT 0 +#define HAVE_AS_IX86_TLS_GET_ADDR_GOT 1 -/* #undef HAVE_LD_DEMANGLE */ +#define HAVE_LD_DEMANGLE 1 I agree with Andreas in the PR that after including config.gcc configure should be using gas and gnu_ld vars rather than gas_flag and gnu_ld_flag, but this patch doesn't implement that (yet). I think to do that, it would need to move the AS_VAR_SET_IF(gcc_cv_as,, [ AC_MSG_CHECKING(Solaris assembler) # Check if we are using GNU as if not already set. and AC_MSG_CHECKING(Solaris linker) # Identify the linker which will work hand-in-glove with the newly # Check if we are using GNU ld if not already set. hunks in configure.ac from where they are to before config.gcc inclusion, and sed s/\(gnu_ld\|gas\)_flag/\1/g after the config.gcc inclusion. I can prepare/test the patch tomorrow, but IMHO this patch is a good start. 2026-03-18 Jakub Jelinek PR bootstrap/124547 * configure.ac (--with-gnu-ld): Set gnu_ld_flag= instead of gnu_ld_flag=no if not explicitly specified. (--with-gnu-as): Similarly for gas_flag. (DEFAULT_ASSEMBLER): Use wording without GNU as whenever gas_flag is not yes rather than when it is no. * configure: Regenerate. --- gcc/configure | 6 +++--- gcc/configure.ac | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/configure b/gcc/configure index c7b96446c83..f4939ebaa98 100755 --- a/gcc/configure +++ b/gcc/configure @@ -3931,7 +3931,7 @@ fi if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; gnu_ld_flag="$with_gnu_ld" else - gnu_ld_flag=no + gnu_ld_flag= fi @@ -4037,7 +4037,7 @@ fi if test "${with_gnu_as+set}" = set; then : withval=$with_gnu_as; gas_flag="$with_gnu_as" else - gas_flag=no + gas_flag= fi @@ -4063,7 +4063,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a default assembler was specified" >&5 $as_echo_n "checking whether a default assembler was specified... " >&6; } if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test x"$gas_flag" = x"no"; then + if test x"$gas_flag" != x"yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($DEFAULT_ASSEMBLER)" >&5 $as_echo "yes ($DEFAULT_ASSEMBLER)" >&6; } else diff --git a/gcc/configure.ac b/gcc/configure.ac index 2868785f201..5fb5a43f316 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -336,7 +336,7 @@ AC_SUBST(GENINSRC) 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) +gnu_ld_flag=) case $target in *darwin*) @@ -415,7 +415,7 @@ fi 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) +gas_flag=) AC_ARG_WITH(as, [AS_HELP_STRING([--with-as], [arrange to use the specified as (full pathname)])], @@ -432,7 +432,7 @@ fi AC_MSG_CHECKING([whether a default assembler was specified]) if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test x"$gas_flag" = x"no"; then + if test x"$gas_flag" != x"yes"; then AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) else AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])