On Thu, Feb 5, 2026 at 4:26 PM Rainer Orth <[email protected]> 
wrote:
>
> This patch
>
> commit cc12934b555625b130e242eb6199c60b353ab509
> Author: Rainer Orth <[email protected]>
> Date:   Tue Feb 3 20:41:40 2026 +0100
>
>     build: Only use gas_flag/gnu_ld_flag internally [PR123841]
>
> caused testsuite regressions on Linux/x86_64 in one configuration: if
> configured without --with-gnu-as/--with-gnu-ld, taking as and ld from
> PATH, the stage 1 gcc/auto-host.h differs:
>
> @@ -538 +544 @@
> -#define HAVE_AS_IX86_GOT32X 1
> +#define HAVE_AS_IX86_GOT32X 0
> @@ -586 +592 @@
> -#define HAVE_AS_IX86_TLSLDM 1
> +#define HAVE_AS_IX86_TLSLDM 0
> @@ -599 +605 @@
> -#define HAVE_AS_IX86_TLS_GET_ADDR_GOT 1
> +#define HAVE_AS_IX86_TLS_GET_ADDR_GOT 0
> @@ -1795 +1801 @@
> -#define HAVE_LD_DEMANGLE 1
> +/* #undef HAVE_LD_DEMANGLE */
>
> gas_flag and gnu_ld_flag weren't set correctly in this case:
>
> Without --with-gnu-ld, AC_ARG_WITH(gnu-ld) sets gnu_ld_flag to no.  The
> later check to determine gnu_ld_flag from $gcc_cv_ld --version isn't
> even run because it is guarded by test -z "$gnu_ld_flag".
>
> To avoid this, two things need to happen:
>
> * The ld --version check needs to be done in the ACTION_IF_NOT case of
>   AC_ARG_WITH(gnu-ld), not afterwards.
>
> * For this to work, gcc_cv_ld needs to be set at this point.
>
> Therefore this patch does the first.  In order for the second to work,
> AC_ARG_WITH(gnu-ld) is moved later when gcc_cv_ld has already been set.
>
> The same applies to gas_flag, too.
>
> Tested on x86_64-pc-linux-gnu and sparc64-pc-linux-gnu like so:
>
> * Establish a baseline before my gas_flag/gnu_ld_flag patches:
>
>   commit f75fe68437e3cd62548370f9653aae7fee8c621c
>   Author: Rainer Orth <[email protected]>
>   Date:   Tue Jan 27 19:11:11 2026 +0100
>
>       build: Only use --fatal-warnings if assembler supports it
>
>   configure with --disable-bootstrap --enable-languages=c++ in various
>   combinations:
>
>   * without anything more, taking as/ld from PATH
>
>   * the same with --with-gnu-as --with-gnu-ld added
>
>   * specifying --with-as=/usr/bin/as --with-ld=/usr/bin/ld instead
>
>   * the same with --with-gnu-as --with-gnu-ld added
>
>   then run make configure-gcc and compare gcc/auto-host.h files.
>
> * At current trunk, there are two differences:
>
> ** The ones described above.
>
> ** HAVE_AFUNIX_H that was added to configure.ac since.
>
> * With the current patch, all differences to the baseline vanish again,
>   with the exception of the latter.
>
> Ok for trunk?

OK.

Richard.

> I'm concentrating on Linux/x86_64 and Linux/sparc64 for now.  The test
> matrix with
>
> * Solaris on sparc and x86, with
>
>   * native as/ld, or
>
>   * GNU as/ld,
>
> * FreeBSD/amd64 with either
>
>   * lld as /usr/bin/ld, or
>
>   * GNU ld,
>
> * and Darwin with
>
>   * cctools as, which identifies as gas 1.38 although not taking gas
>     --32/--64 options in old OS versions,
>
>   * as later replaced by a clang-based one, and
>
>   * ld which is ld64 instead of GNU ld
>
> is so much larger that it's more important to get Linux back on track
> first.
>
> However, the others will allow to investigate non-GNU configurations in
> more detail.
>
>         Rainer
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>
>
> 2026-02-04  Rainer Orth  <[email protected]>
>
>         gcc:
>         * 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.
>

Reply via email to