]> git.ipfire.org Git - thirdparty/gcc.git/commit
build: Properly set gas_flag/gnu_ld_flag
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 6 Feb 2026 19:31:27 +0000 (20:31 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 6 Feb 2026 19:31:27 +0000 (20:31 +0100)
commitfdd1d058f289eda39b6eb1386a0dabef3478d298
treedb8f5c74f274e280546e031e7ba18056afe78b74
parentf210e0bb90970a7fda6cf94e2694ea209eb61a16
build: Properly set gas_flag/gnu_ld_flag

This patch

commit cc12934b555625b130e242eb6199c60b353ab509
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
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-unknown-linux-gnu like so:

* Establish a baseline before my gas_flag/gnu_ld_flag patches:

  commit f75fe68437e3cd62548370f9653aae7fee8c621c
  Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
  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.

2026-02-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

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.
gcc/configure
gcc/configure.ac