Once gas_flag has been determined reliably on x86 and SPARC, the result
can be used to set gcc_cv_as_flags.

Tested on {i386,amd64}-pc-solaris2.11, sparc{,v9}-sun-solaris2.11,
{x86_64,i686}-pc-linux-gnu, amd64-pc-freebsd15.0, and
sparc64-unknown-linux-gnu.

Ok for trunk?

Again, this is very sensitive and error-prone, so all reviews and
testing are highly appreciated.

Thanks.

        Rainer

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


2026-01-28  Rainer Orth  <[email protected]>

        gcc:
        PR other/123841
        PR target/123926
        * acinclude.m4 (gcc_GAS_FLAGS): Handle x86 and SPARC/gas cases
        separately.
        * configure: Regenerate.

# HG changeset patch
# Parent  a4aa0812be14f08b7d51d1351b6ce79a87c3d4cb
build: Don't use gas options with Darwin/x86 as [PR123841]

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -489,7 +489,7 @@ AC_DEFUN([gcc_GAS_FLAGS],
     esac
     ;;
   *-*-solaris2*:no)
-    dnl Override the default, which may be incompatible.
+    dnl Solaris with the native assembler uses -m32/-m64 consistently.
     case "$target" in
       i?86-*-* | sparc-*-*)
 	gcc_cv_as_flags=-m32
@@ -501,16 +501,16 @@ AC_DEFUN([gcc_GAS_FLAGS],
     as_32_opt=-m32
     as_64_opt=-m64
     ;;
-  i?86-*-*:* | x86_64-*-*:* )
-    dnl Override the default, which may be incompatible.
+  i?86-*-*:yes | x86_64-*-*:yes | sparc*-*-*:yes)
+    dnl x86 and SPARC with the GNU assembler use --32/--64/--x32.
     case "$target" in
-      i?86-*-*)
+      i?86-*-* | sparc-*-*)
 	gcc_cv_as_flags=--32
 	;;
       x86_64-*-linux-gnux32*)
 	gcc_cv_as_flags=--x32
 	;;
-      x86_64-*-linux*)
+      x86_64-*-* | sparcv9-*-* | sparc64-*-*)
 	gcc_cv_as_flags=--64
 	;;
     esac
diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -26164,15 +26164,15 @@ else
     as_32_opt=-m32
     as_64_opt=-m64
     ;;
-  i?86-*-*:* | x86_64-*-*:* )
+  i?86-*-*:yes | x86_64-*-*:yes | sparc*-*-*:yes)
         case "$target" in
-      i?86-*-*)
+      i?86-*-* | sparc-*-*)
 	gcc_cv_as_flags=--32
 	;;
       x86_64-*-linux-gnux32*)
 	gcc_cv_as_flags=--x32
 	;;
-      x86_64-*-linux*)
+      x86_64-*-* | sparcv9-*-* | sparc64-*-*)
 	gcc_cv_as_flags=--64
 	;;
     esac

Reply via email to