[compiler-rt] 4dec62f - [builtins][CMake] Replace custom target for lse_builtin symlinks (#66936)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 11:57:22 PDT 2023


Author: Petr Hosek
Date: 2023-09-21T11:57:18-07:00
New Revision: 4dec62f4d4a0a496a8067e283bf66897fbf6e598

URL: https://github.com/llvm/llvm-project/commit/4dec62f4d4a0a496a8067e283bf66897fbf6e598
DIFF: https://github.com/llvm/llvm-project/commit/4dec62f4d4a0a496a8067e283bf66897fbf6e598.diff

LOG: [builtins][CMake] Replace custom target for lse_builtin symlinks (#66936)

Using custom target with BYPRODUCTS results in symlinks being recreated
on every build (the build is always dirty). We could instead use custom
commands to generate the symlinks and by adding the output to the list
of sources, build system will ensure those are created as needed.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 43ef62ffb115d9d..1afceddc62d846f 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -567,9 +567,13 @@ 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")
-        list(APPEND lse_builtins "${helper_asm}")
-        list(APPEND arm64_lse_commands COMMAND ${CMAKE_COMMAND} -E ${COMPILER_RT_LINK_OR_COPY} "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S" "${helper_asm}")
+        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}"
@@ -827,16 +831,6 @@ else ()
         list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
       endif()
 
-      if(arch STREQUAL "aarch64")
-        add_custom_target(
-          lse_builtin_symlinks
-          BYPRODUCTS ${lse_builtins}
-          ${arm64_lse_commands}
-        )
-
-        set(deps_aarch64 lse_builtin_symlinks)
-      endif()
-
       add_compiler_rt_runtime(clang_rt.builtins
                               STATIC
                               ARCHS ${arch}


        


More information about the llvm-commits mailing list