]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
build: Use separate options for Darwin as [PR123841]
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 3 Feb 2026 19:34:10 +0000 (20:34 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 3 Feb 2026 19:34:10 +0000 (20:34 +0100)
Since

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

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

gcc/acinclude.m4
gcc/configure

index aef4ca46db88e73bb2c4fc2ceb5e58c4ad2298f7..89e00a16f1d207c8e599da49a161b9839f1e2fac 100644 (file)
@@ -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.
index b708db893d8867371bb4ca040f3575db2f19fcdf..e8b5c4a7118aacea6cd9626e763dbb72f6688ced 100755 (executable)
@@ -26146,6 +26146,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-*-*)
@@ -26173,9 +26195,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"
     ;;