[PATCH] D69685: Prevent adding lld to test dependency (TEST_DEPS) when lld project is not built

Anh Tuyen Tran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 14:15:06 PDT 2019


anhtuyen created this revision.
anhtuyen added reviewers: pcc, eugenis.
anhtuyen added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, steven.zhang.

https://reviews.llvm.org/D69405 added

  check_linker_flag("-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)

into **compiler-rt/cmake/config-ix.cmake**.

And, if the compiler used to build llvm can support **-fuse-ld=lld**, then **COMPILER_RT_HAS_LLD** will be set on line 500 of **compiler-rt/CMakeLists.txt**.

  set(COMPILER_RT_HAS_LLD ${COMPILER_RT_HAS_FUSE_LD_LLD_FLAG})

The changes above then adds **lld** into the **TEST_DEPS **dependency online 471 of **compiler-rt/cmake/Modules/AddCompilerRT.cmake**

  if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_HAS_LLD)
    # CMAKE_EXE_LINKER_FLAGS may contain -fuse=lld
    # FIXME: -DLLVM_ENABLE_LLD=ON and -DLLVM_ENABLE_PROJECTS without lld case.
    list(APPEND TEST_DEPS lld)
  endif()

This will cause failure if running LIT when the compiler was built **without lld**.

  ninja: error: 'llvm/compiler-rt/lib/asan/tests/lld', needed by 'projects/compiler-rt/lib/asan/tests/dynamic/Asan-powerpc64le-calls-Dynamic-Test', missing and no known rule to make it

The patch is to fix the above-mentioned problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69685

Files:
  compiler-rt/cmake/Modules/AddCompilerRT.cmake


Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -465,7 +465,7 @@
     set(TEST_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TEST_LINK_FLAGS}")
     separate_arguments(TEST_LINK_FLAGS)
   endif()
-  if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_HAS_LLD)
+  if(NOT COMPILER_RT_STANDALONE_BUILD AND COMPILER_RT_HAS_LLD AND TARGET lld)
     # CMAKE_EXE_LINKER_FLAGS may contain -fuse=lld
     # FIXME: -DLLVM_ENABLE_LLD=ON and -DLLVM_ENABLE_PROJECTS without lld case.
     list(APPEND TEST_DEPS lld)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69685.227341.patch
Type: text/x-patch
Size: 673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191031/c2c32dae/attachment.bin>


More information about the llvm-commits mailing list