Skip to content

Commit c6023ce

Browse files
committed
[compiler-rt][CMake] Pass all flags to try-compile
The try-compile mechanism requires that `CMAKE_REQUIRED_FLAGS` is a space-separated string instead of a list of flags. The original code expanded BUILTIN_FLAGS into CMAKE_REQUIRED_FLAGS as a space-separated string and then would overwrite CMAKE_REQUIRED_FLAGS with TARGET_${arch}_CFLAGS prepended to the unexpanded BUILTIN_CFLAGS_${arch}. This resulted in the first two arguments being passed into the try-compile invocation, but dropping the other arguments listed in BUILTIN_CFLAGS_${arch}. This patch takes the contents of both TARGET_${arch}_CLFAGS and BUILTIN_FLAGS_${arch}, combines them into a single list, and then joins that list as a space-separated string in `CMAKE_REQUIRED_FLAGS`.
1 parent 75242a8 commit c6023ce

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,10 +854,11 @@ else ()
854854
cmake_push_check_state()
855855
# TODO: we should probably make most of the checks in builtin-config depend on the target flags.
856856
set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS})
857-
# CMAKE_REQUIRED_FLAGS must be a space separated string but unlike TARGET_${arch}_CFLAGS,
858-
# BUILTIN_CFLAGS_${arch} is a CMake list, so we have to join it to create a valid command line.
859-
list(JOIN BUILTIN_CFLAGS " " CMAKE_REQUIRED_FLAGS)
860-
set(CMAKE_REQUIRED_FLAGS "${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}}")
857+
# CMAKE_REQUIRED_FLAGS must be a space separated string
858+
# Join BUILTIN_CFLAGS_${arch} and TARGET_${arch}_CFLAGS as a
859+
# space-separated string.
860+
set(CMAKE_REQUIRED_FLAGS ${BUILTIN_CFLAGS_${arch}} ${TARGET_${arch}_CFLAGS})
861+
list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS)
861862
message(STATUS "Performing additional configure checks with target flags: ${CMAKE_REQUIRED_FLAGS}")
862863
# For ARM archs, exclude any VFP builtins if VFP is not supported
863864
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")

0 commit comments

Comments
 (0)