[lld] 525a400 - [LLD] [ELF] Fix building with LLVM_LINK_LLVM_DYLIB since zstd was taken into use

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 05:14:37 PDT 2022


Author: Martin Storsjö
Date: 2022-09-22T15:14:24+03:00
New Revision: 525a400c7ca5725b4ab456b222176f580caf35e7

URL: https://github.com/llvm/llvm-project/commit/525a400c7ca5725b4ab456b222176f580caf35e7
DIFF: https://github.com/llvm/llvm-project/commit/525a400c7ca5725b4ab456b222176f580caf35e7.diff

LOG: [LLD] [ELF] Fix building with LLVM_LINK_LLVM_DYLIB since zstd was taken into use

This fixes a regression since fa74144c64dff6b145b0b3fa9397f913ddaa87bf;
even if we're linking to the dylib (which handles all the dependencies
in LLVMSupport), we're now also directly referencing zstd from
lld/ELF, and thus need to explicitly express our dependency on it.

Added: 
    

Modified: 
    lld/ELF/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/lld/ELF/CMakeLists.txt b/lld/ELF/CMakeLists.txt
index b37035d3e7429..8195f3bea0f2e 100644
--- a/lld/ELF/CMakeLists.txt
+++ b/lld/ELF/CMakeLists.txt
@@ -6,6 +6,18 @@ if(LLVM_ENABLE_ZLIB)
   set(imported_libs ZLIB::ZLIB)
 endif()
 
+if(LLVM_ENABLE_ZSTD)
+  if(TARGET zstd::libzstd_shared AND NOT LLVM_USE_STATIC_ZSTD)
+    set(zstd_target zstd::libzstd_shared)
+  else()
+    set(zstd_target zstd::libzstd_static)
+  endif()
+endif()
+
+if(LLVM_ENABLE_ZSTD)
+  list(APPEND imported_libs ${zstd_target})
+endif()
+
 add_lld_library(lldELF
   AArch64ErrataFix.cpp
   Arch/AArch64.cpp


        


More information about the llvm-commits mailing list