Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions compiler-rt/lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -854,15 +854,15 @@ else ()
cmake_push_check_state()
# TODO: we should probably make most of the checks in builtin-config depend on the target flags.
set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS})
# CMAKE_REQUIRED_FLAGS must be a space separated string but unlike TARGET_${arch}_CFLAGS,
# BUILTIN_CFLAGS_${arch} is a CMake list, so we have to join it to create a valid command line.
list(JOIN BUILTIN_CFLAGS " " CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_FLAGS "${TARGET_${arch}_CFLAGS} ${BUILTIN_CFLAGS_${arch}}")
# CMAKE_REQUIRED_FLAGS must be a space separated string
# Join BUILTIN_CFLAGS_${arch} and TARGET_${arch}_CFLAGS as a
# space-separated string.
set(CMAKE_REQUIRED_FLAGS ${BUILTIN_CFLAGS_${arch}} ${TARGET_${arch}_CFLAGS})
list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to overwrite CMAKE_REQUIRED_FLAGS set by parent directories. Instead, we should be concatenating the flags.

Suggested change
set(CMAKE_REQUIRED_FLAGS ${BUILTIN_CFLAGS_${arch}} ${TARGET_${arch}_CFLAGS})
list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS)
set(BUILTIN_CFLAGS ${BUILTIN_CFLAGS_${arch}} ${TARGET_${arch}_CFLAGS})
list(JOIN BUILTIN_CFLAGS " " BUILTIN_CFLAGS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${BUILTIN_CFLAGS}")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original behavior also did not include existing CMAKE_REQUIRED_FLAGS. Fixed.

message(STATUS "Performing additional configure checks with target flags: ${CMAKE_REQUIRED_FLAGS}")
# For ARM archs, exclude any VFP builtins if VFP is not supported
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
check_compile_definition(__ARM_FP "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
check_compile_definition(__ARM_FP "${CMAKE_C_FLAGS}" COMPILER_RT_HAS_${arch}_VFP)
if(NOT COMPILER_RT_HAS_${arch}_VFP)
list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES} ${arm_Thumb1_VFPv2_SP_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
else()
Expand Down