[compiler-rt] 97562e7 - pass target triple to `check_assembler_flag` (#188521)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 1 03:00:59 PDT 2026
Author: Andrew Marshall
Date: 2026-04-01T11:00:53+01:00
New Revision: 97562e7e5cae5d6dc019b8f3275eb9639978c05f
URL: https://github.com/llvm/llvm-project/commit/97562e7e5cae5d6dc019b8f3275eb9639978c05f
DIFF: https://github.com/llvm/llvm-project/commit/97562e7e5cae5d6dc019b8f3275eb9639978c05f.diff
LOG: pass target triple to `check_assembler_flag` (#188521)
Target specific flags (Notably `-mimplict=always` for ARM) are not
recognized by the clang assembler unless the target is specified. This
PR passes the value of `CMAKE_C_COMPILER_TARGET` to the assembler so
that target specific flags are recognized.
## Previous behaviour
When configuring builtins for an ARMv7 target:
```
-- Builtin supported architectures: armv7
-- Checking for assembler flag -mimplicit-it=always
-- Checking for assembler flag -mimplicit-it=always - Not accepted
-- Checking for assembler flag -Wa,-mimplicit-it=always
-- Checking for assembler flag -Wa,-mimplicit-it=always - Not accepted
CMake Warning at CMakeLists.txt:462 (message):
Don't know how to set the -mimplicit-it=always flag in this assembler; not
including Arm optimized implementations
```
## New behaviour
```
-- Builtin supported architectures: armv7
-- Checking for assembler flag -mimplicit-it=always
-- Checking for assembler flag -mimplicit-it=always - Accepted
```
## Steps to reproduce:
```
$ cmake -S compiler-rt/lib/builtins -B build \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_C_COMPILER_TARGET=armv7-unknown-linux-gnueabihf \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
```
Added:
Modified:
compiler-rt/cmake/Modules/CheckAssemblerFlag.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/CheckAssemblerFlag.cmake b/compiler-rt/cmake/Modules/CheckAssemblerFlag.cmake
index ace80ce5583c7..7c3f7ac681cb7 100644
--- a/compiler-rt/cmake/Modules/CheckAssemblerFlag.cmake
+++ b/compiler-rt/cmake/Modules/CheckAssemblerFlag.cmake
@@ -26,6 +26,7 @@ function(check_assembler_flag outvar flag)
try_compile(${outvar}
${CMAKE_BINARY_DIR}
SOURCES ${asm_source_file}
+ CMAKE_FLAGS -DCMAKE_ASM_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET}
COMPILE_DEFINITIONS ${flag})
if(NOT CMAKE_REQUIRED_QUIET)
More information about the llvm-commits
mailing list