https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123841
--- Comment #19 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot
Uni-Bielefeld.DE> ---
> --- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> Ah, then yeah, we should reopen and go with a safer variant, i.e.
> i?86-*-solaris2*:* | x86_64-*-solaris2*:* | i?86-*-linux*:* |
> x86_64-*-linux*:* )
> So, basically go back to what the code was doing before, except for solaris.
That's an option, but the patch I'm currently testing goes the other way
round, matching what Solaris does. This avoids the fact that Darwin as
creates 64-bit objects by default all the way back to macOS 10.7, even
for a 32-bit-default build. This may or may not make a difference to
what happens without any options passed to as, but it seems more correct
to me. I'll report my findings and let Iain decide what he prefers.
We could still restrict setting gcc_cv_as_flags etc. to Solaris/x86 with
gas and Linux if we like.
diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -478,7 +478,21 @@ AC_DEFUN([gcc_GAS_FLAGS],
as_32_opt=-m32
as_64_opt=-m64
;;
- i?86-*-*:* | x86_64-*-*:* )
+ i?86-*-darwin*:no | x86_64-*-darwin*:no)
+ dnl The native Darwin assembler needs different options and creates
+ dnl 64-bit objects by default.
+ case "$target" in
+ i?86-*-*)
+ gcc_cv_as_flags="-arch i386"
+ ;;
+ x86_64-*-*)
+ gcc_cv_as_flags="-arch x86_64"
+ ;;
+ esac
+ as_32_opt="-arch i386"
+ as_64_opt="-arch x86_64"
+ ;;
+ i?86-*-*:* | x86_64-*-*:*)
dnl Override the default, which may be incompatible.
case "$target" in
i?86-*-*)