Skip to content

Commit

Permalink
Adapt "cross compile?" check for Apple Silicon
Browse files Browse the repository at this point in the history
This piece of code tries to implement the semantics "cross compile?" to
determine CFLAGS used for test binary compilation.
```
if(ANDROID OR ${arch} MATCHES "arm|aarch64|riscv32|riscv64")
```

Since Apple Silicon, macOS runs on arm64e, so we take the wrong branch
when compiling and running tests locally "on the host" on an AS machine.

Furthermore, for Apple code, we use the separate
`get_test_cflags_for_apple_platform` function to determine these test
compiliation flags and `get_test_cc_for_arch` is only ever used in the
"compile & run on host" case, so we can short-curcuit the "cross
compile?" check here.

rdar://91446703

Differential Revision: https://reviews.llvm.org/D123633
  • Loading branch information
Julian Lettner committed Apr 13, 2022
1 parent 343f3de commit 8887c63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler-rt/cmake/config-ix.cmake
Expand Up @@ -244,7 +244,7 @@ endfunction()
# specific architecture. When cross-compiling, this is controled via
# COMPILER_RT_TEST_COMPILER and COMPILER_RT_TEST_COMPILER_CFLAGS.
macro(get_test_cc_for_arch arch cc_out cflags_out)
if(ANDROID OR ${arch} MATCHES "arm|aarch64|riscv32|riscv64")
if(ANDROID OR (NOT APPLE AND ${arch} MATCHES "arm|aarch64|riscv32|riscv64"))
# This is only true if we are cross-compiling.
# Build all tests with host compiler and use host tools.
set(${cc_out} ${COMPILER_RT_TEST_COMPILER})
Expand Down

0 comments on commit 8887c63

Please sign in to comment.