Skip to content

Commit e5eae76

Browse files
arichardsonetcwilde
authored andcommitted
[compiler-rt] Fix detecting _Float16 support for secondary targets (llvm#117813)
It turns out we were not passing -m32 to the check_c_source_compiles() invocation since CMAKE_REQUIRE_FLAGS needs to be string separated list and we were passing a ;-separated CMake list which appears to be parsed by CMake as 'ignore all arguments beyond the first'. Fix this by transforming the list to a command line first. With this change, Clang 17 no longer claims to support _Float16 for i386. (cherry picked from commit a4c8ef0)
1 parent d2ed2d2 commit e5eae76

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: compiler-rt/lib/builtins/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,12 @@ else ()
848848
if (CAN_TARGET_${arch})
849849
cmake_push_check_state()
850850
# TODO: we should probably make most of the checks in builtin-config depend on the target flags.
851-
message(STATUS "Performing additional configure checks with target flags: ${TARGET_${arch}_CFLAGS}")
852851
set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS})
853-
list(APPEND CMAKE_REQUIRED_FLAGS ${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}})
852+
# CMAKE_REQUIRED_FLAGS must be a space separated string but unlike TARGET_${arch}_CFLAGS,
853+
# BUILTIN_CFLAGS_${arch} is a CMake list, so we have to join it to create a valid command line.
854+
list(JOIN BUILTIN_CFLAGS " " CMAKE_REQUIRED_FLAGS)
855+
set(CMAKE_REQUIRED_FLAGS "${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}}")
856+
message(STATUS "Performing additional configure checks with target flags: ${CMAKE_REQUIRED_FLAGS}")
854857
# For ARM archs, exclude any VFP builtins if VFP is not supported
855858
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
856859
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")

0 commit comments

Comments
 (0)