Skip to content

Commit 15d1ee3

Browse files
tambrytstellar
authored andcommitted
[CMake][compiler-rt] Use copying instead of symlinking for LSE builtins on non-Unix-likes
As reported in D93278 post-review symlinking requires privilege escalation on Windows. Copying is functionally same, so fallback to it for systems that aren't Unix-like. This is similar to the solution in AddLLVM.cmake. Reviewed By: ikudrin Differential Revision: https://reviews.llvm.org/D98111 (cherry picked from commit ba86096)
1 parent bff59ac commit 15d1ee3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler-rt/lib/builtins/CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,20 @@ set(aarch64_SOURCES
515515
set(OA_HELPERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/outline_atomic_helpers.dir")
516516
file(MAKE_DIRECTORY "${OA_HELPERS_DIR}")
517517

518+
if(CMAKE_HOST_UNIX)
519+
set(COMPILER_RT_LINK_OR_COPY create_symlink)
520+
else()
521+
set(COMPILER_RT_LINK_OR_COPY copy)
522+
endif()
523+
518524
foreach(pat cas swp ldadd ldclr ldeor ldset)
519525
foreach(size 1 2 4 8 16)
520526
foreach(model 1 2 3 4)
521527
if(pat STREQUAL "cas" OR NOT size STREQUAL "16")
522528
set(helper_asm "${OA_HELPERS_DIR}/outline_atomic_${pat}${size}_${model}.S")
523529
add_custom_command(
524530
OUTPUT ${helper_asm}
525-
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S" "${helper_asm}"
531+
COMMAND ${CMAKE_COMMAND} -E ${COMPILER_RT_LINK_OR_COPY} "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S" "${helper_asm}"
526532
)
527533
set_source_files_properties("${helper_asm}"
528534
PROPERTIES

0 commit comments

Comments
 (0)