Hi Iain,

>> Will comment on the BZ when the bootstrap is done,
>
> Thanks.  I'll post a revised patch with the gas_flag handling explained
> before committing.

---------------------------------------------------------------------------

Since

commit 5fc4e333b42d12aca71587f83f2d2c5be9633146
Author: Rainer Orth <[email protected]>
Date:   Tue Jan 27 19:15:36 2026 +0100

    build: Unify 32 and 64-bit assembler handling

gcc/acinclude.m4 uses gas-only flags --32/--64 on Darwin/x86 with the
native assembler, which breaks many configure tests.

This patch uses the Darwin as options instead, handling the PowerPC
cases at the same time.

Tested on x86_64-apple-darwin21.6.0 and 386-apple-darwin17.7.0.


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

        gcc:
        PR other/123841
        * acinclude.m4 (gcc_GAS_FLAGS): Handle Darwin as cases separately.
        * configure: Regenerate.

# HG changeset patch
# Parent  cd15a6dc87cf118053de20eeb652fb14c0b32fd6
build: Use separate options for Darwin as [PR123841]

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -465,6 +465,33 @@ dnl #
 AC_DEFUN([gcc_GAS_FLAGS],
 [AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags,
 [ case "$target:$gas_flag" in
+  *-*-darwin*:*)
+    dnl Darwin with the native assembler uses -arch i386/x86_64/ppc/ppc64.
+    dnl
+    dnl Old cctools versions of the Darwin assembler identify as "GNU
+    dnl assembler version 1.38", but still accept the same options as later
+    dnl clang-based ones, so treat them all the same regardless.
+    case "$target" in
+      i?86-*-*)
+	gcc_cv_as_flags="-arch i386"
+	;;
+      powerpc64*-*-*)
+	gcc_cv_as_flags="-arch ppc64"
+	;;
+      powerpc*-*-*)
+	gcc_cv_as_flags="-arch ppc"
+	;;
+      x86_64-*-*)
+	gcc_cv_as_flags="-arch x86_64"
+	;;
+    esac
+    case "$target" in
+      i?86-*-* | x86_64-*-*)
+	as_32_opt="-arch i386"
+	as_64_opt="-arch x86_64"
+	;;
+    esac
+    ;;
   *-*-solaris2*:no)
     dnl Override the default, which may be incompatible.
     case "$target" in
@@ -494,10 +521,6 @@ AC_DEFUN([gcc_GAS_FLAGS],
     as_32_opt=--32
     as_64_opt=--64
     ;;
-  powerpc*-*-darwin*:*)
-    dnl Always pass -arch ppc to assembler.
-    gcc_cv_as_flags="-arch ppc"
-    ;;
   amdgcn*:*)
     dnl Currently, only the llvm-mc assembler is supported.
     dnl Add flags to ensure an amdgcn ELF file is written.
diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -26112,6 +26112,28 @@ if ${gcc_cv_as_flags+:} false; then :
   $as_echo_n "(cached) " >&6
 else
    case "$target:$gas_flag" in
+  *-*-darwin*:*)
+                        case "$target" in
+      i?86-*-*)
+	gcc_cv_as_flags="-arch i386"
+	;;
+      powerpc64*-*-*)
+	gcc_cv_as_flags="-arch ppc64"
+	;;
+      powerpc*-*-*)
+	gcc_cv_as_flags="-arch ppc"
+	;;
+      x86_64-*-*)
+	gcc_cv_as_flags="-arch x86_64"
+	;;
+    esac
+    case "$target" in
+      i?86-*-* | x86_64-*-*)
+	as_32_opt="-arch i386"
+	as_64_opt="-arch x86_64"
+	;;
+    esac
+    ;;
   *-*-solaris2*:no)
         case "$target" in
       i?86-*-* | sparc-*-*)
@@ -26139,9 +26161,6 @@ else
     as_32_opt=--32
     as_64_opt=--64
     ;;
-  powerpc*-*-darwin*:*)
-        gcc_cv_as_flags="-arch ppc"
-    ;;
   amdgcn*:*)
             gcc_cv_as_flags="--filetype=obj -triple=amdgcn--amdhsa"
     ;;

Reply via email to