Skip to content
Closed
Changes from all 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
44 changes: 23 additions & 21 deletions compiler-rt/lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -599,27 +599,29 @@ else()
set(COMPILER_RT_LINK_OR_COPY copy)
endif()

foreach(pat cas swp ldadd ldclr ldeor ldset)
foreach(size 1 2 4 8 16)
foreach(model 1 2 3 4 5)
if(pat STREQUAL "cas" OR NOT size STREQUAL "16")
set(source_asm "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S")
set(helper_asm "${OA_HELPERS_DIR}/outline_atomic_${pat}${size}_${model}.S")
add_custom_command(
OUTPUT "${helper_asm}"
COMMAND ${CMAKE_COMMAND} -E ${COMPILER_RT_LINK_OR_COPY} "${source_asm}" "${helper_asm}"
DEPENDS "${source_asm}"
)
set_source_files_properties("${helper_asm}"
PROPERTIES
COMPILE_DEFINITIONS "L_${pat};SIZE=${size};MODEL=${model}"
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"
)
list(APPEND aarch64_SOURCES "${helper_asm}")
endif()
endforeach(model)
endforeach(size)
endforeach(pat)
if(COMPILER_RT_HAS_ASM_LSE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

COMPILER_RT_HAS_ASM_LSE is not the right flag for this; it will turn off these files for other builds where they should be included. If we really want to explicitly exclude MSVC, if (NOT MSVC) is the right check.

Copy link
Member

Choose a reason for hiding this comment

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

if (NOT MSVC) also covers builds in clang-cl mode (as the cmake MSVC flag primarily indicates the general command line style of the compiler - I think it also is set for the intel compiler for windows, that also uses a cl-style interface).

To properly single out MSVC as opposed to clang-cl, we'd need to check CMAKE_C_COMPILER_ID.

foreach(pat cas swp ldadd ldclr ldeor ldset)
foreach(size 1 2 4 8 16)
foreach(model 1 2 3 4 5)
if(pat STREQUAL "cas" OR NOT size STREQUAL "16")
set(source_asm "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S")
set(helper_asm "${OA_HELPERS_DIR}/outline_atomic_${pat}${size}_${model}.S")
add_custom_command(
OUTPUT "${helper_asm}"
COMMAND ${CMAKE_COMMAND} -E ${COMPILER_RT_LINK_OR_COPY} "${source_asm}" "${helper_asm}"
DEPENDS "${source_asm}"
)
set_source_files_properties("${helper_asm}"
PROPERTIES
COMPILE_DEFINITIONS "L_${pat};SIZE=${size};MODEL=${model}"
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"
)
list(APPEND aarch64_SOURCES "${helper_asm}")
endif()
endforeach(model)
endforeach(size)
endforeach(pat)
endif()

if (MINGW)
set(aarch64_SOURCES
Expand Down
Loading