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  <jakub@redhat.com>

	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.
This commit is contained in:
Jakub Jelinek
2026-03-18 08:41:13 +01:00
committed by Jakub Jelinek
parent 6348a1fd50
commit c31ce49786
2 changed files with 6 additions and 6 deletions

6
gcc/configure vendored
View File

@@ -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

View File

@@ -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)])