Skip to content

Commit a2ce564

Browse files
authored
[compiler-rt][cmake] Test COMPILER_RT_HAS_AARCH64_SME with arm64 (#141115)
architecture only. Apple configures CMake only once for compiler-rt, even when building for multiple architectures. As a result, we need to explicitly test for arm64 specific attributes by building for that architecture
1 parent f398f2a commit a2ce564

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

compiler-rt/cmake/Modules/BuiltinTests.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,16 @@ function(builtin_check_c_compiler_source output source)
134134
endif()
135135
endif()
136136
endfunction()
137+
138+
function(builtin_check_c_compiler_source_with_flags output source flags)
139+
if(NOT DEFINED ${output})
140+
message(STATUS "Performing Test ${output}")
141+
try_compile_only(result SOURCE ${source} FLAGS ${flags})
142+
set(${output} ${result} CACHE INTERNAL "Compiler supports ${output} with ${flags}")
143+
if(${result})
144+
message(STATUS "Performing Test ${output} - Success")
145+
else()
146+
message(STATUS "Performing Test ${output} - Failed")
147+
endif()
148+
endif()
149+
endfunction()

compiler-rt/cmake/builtin-config-ix.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ asm(\".arch armv8-a+lse\");
4141
asm(\"cas w0, w1, [x2]\");
4242
")
4343

44-
builtin_check_c_compiler_source(COMPILER_RT_HAS_AARCH64_SME
44+
builtin_check_c_compiler_source_with_flags(COMPILER_RT_HAS_AARCH64_SME
4545
"
4646
void foo(void) __arm_streaming_compatible {
4747
asm(\".arch armv9-a+sme2\\n\"
4848
\"smstart\\n\"
4949
\"ldr zt0, [sp]\");
5050
}
51-
")
51+
" "-target aarch64-linux-gnu")
5252

5353
check_include_files("sys/auxv.h" COMPILER_RT_HAS_AUXV)
5454

0 commit comments

Comments
 (0)