https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107860

--- Comment #6 from simon at pushface dot org ---
The situation with aarch64-apple-darwin vs x86_64-apple-darwin isn't I think
quite like the standard cross-compilation scenario, because of Apple's Rosetta
x86_64 emulation and the fact that all the low-level tools (as, ld, ...)
support both architectures.

If I take an x86_64-apple-darwin compiler and run it on aarch64-apple-darwin it
will generate x86_64 assembler and invoke as, ld with the right switches to
create x86_84 binaries and executables; the executables will run on aarch64
under Rosetta or on x86_64 natively.

So I'm not sure what --build, --host should have been set to (given I don't
want a cross-compiler; the cross- facilities are provided by macOS under the
hood).

In what I was trying to do, the host machine was aarch64-apple-darwin22, but
notably aarch64 running Rosetta. The boot compiler was x86_64-apple-darwin21.

Anyway, the issue here was the way that configure invoked the assembler;
/usr/bin/as will assume it's targeting aarch64 (aka arm64) unless told
different.

These are the results of compiling the test case:

   $ cat conftest-filds-fists.s
   // $gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s
           filds (%ebp)
           fists (%ebp)

with /usr/bin/as -c -b conftest-filds-fists.s -o conftest-filds-fists.o

(a) on x86_64

Apple clang version 14.0.0 (clang-1400.0.29.201)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple
x86_64-apple-macosx12.0.0 -filetype obj -main-file-name conftest-filds-fists.s
-target-cpu penryn -fdebug-compilation-dir=/Users/simon/tmp
-dwarf-debug-producer "Apple clang version 14.0.0 (clang-1400.0.29.201)"
-dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm
-disable-aligned-alloc-awareness=1 -o conftest-filds-fists.o
conftest-filds-fists.s

(b) on aarch64

$ /usr/bin/as -c -v conftest-filds-fists.s -o conftest-filds-fists.o
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple
arm64-apple-macosx13.0.0 -filetype obj -main-file-name conftest-filds-fists.s
-target-cpu apple-m1 -target-feature +v8.5a -target-feature +fp-armv8
-target-feature +neon -target-feature +crc -target-feature +crypto
-target-feature +dotprod -target-feature +fp16fml -target-feature +ras
-target-feature +lse -target-feature +rdm -target-feature +rcpc -target-feature
+zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4
-target-feature +sha3 -target-feature +sha2 -target-feature +aes
-fdebug-compilation-dir=/Volumes/Miscellaneous1/x86_64/gcc-13-20221120/gcc
-dwarf-debug-producer "Apple clang version 14.0.0 (clang-1400.0.29.202)"
-dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm
-disable-aligned-alloc-awareness=1 -o conftest-filds-fists.o
conftest-filds-fists.s
conftest-filds-fists.s:2:16: error: unknown token in expression
        filds (%ebp)
               ^
conftest-filds-fists.s:2:15: error: invalid operand
        filds (%ebp)
              ^
conftest-filds-fists.s:3:16: error: unknown token in expression
        fists (%ebp)
               ^
conftest-filds-fists.s:3:15: error: invalid operand
        fists (%ebp)
              ^
(c) on aarch64, with -arch x86_64

$ /usr/bin/as -c -v conftest-filds-fists.s -o conftest-filds-fists.o -arch
x86_64
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple
x86_64-apple-macosx13.0.0 -filetype obj -main-file-name conftest-filds-fists.s
-target-cpu penryn
-fdebug-compilation-dir=/Volumes/Miscellaneous1/x86_64/gcc-13-20221120/gcc
-dwarf-debug-producer "Apple clang version 14.0.0 (clang-1400.0.29.202)"
-dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mllvm
-disable-aligned-alloc-awareness=1 -o conftest-filds-fists.o
conftest-filds-fists.s

========================

I think the solution to this PR might be to set it as INVALID or WONTFIX? up to
you.

Reply via email to