From 61cff9079c083fdcfb9fa324e50b9e480165037e Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Thu, 22 Sep 2022 15:01:04 +0200 Subject: [PATCH] [BOLT] Support building bolt when LLVM_LINK_LLVM_DYLIB is ON This does *not* link with libLLVM, but with static archives instead. Not super-great, but at least the build works, which is probably better than failing. Related to #57551 Differential Revision: https://reviews.llvm.org/D134434 --- bolt/lib/Core/CMakeLists.txt | 1 + bolt/lib/Passes/CMakeLists.txt | 2 ++ bolt/lib/Profile/CMakeLists.txt | 2 ++ bolt/lib/Rewrite/CMakeLists.txt | 2 ++ bolt/lib/RuntimeLibs/CMakeLists.txt | 2 ++ bolt/lib/Target/AArch64/CMakeLists.txt | 2 ++ bolt/lib/Target/X86/CMakeLists.txt | 2 ++ bolt/lib/Utils/CMakeLists.txt | 2 ++ bolt/tools/bat-dump/CMakeLists.txt | 2 ++ bolt/tools/driver/CMakeLists.txt | 2 ++ bolt/tools/heatmap/CMakeLists.txt | 1 + bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt | 2 ++ bolt/tools/merge-fdata/CMakeLists.txt | 2 ++ bolt/unittests/Core/CMakeLists.txt | 2 ++ bolt/unittests/Profile/CMakeLists.txt | 2 ++ 15 files changed, 28 insertions(+) diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt index 501b5eb..c09a439 100644 --- a/bolt/lib/Core/CMakeLists.txt +++ b/bolt/lib/Core/CMakeLists.txt @@ -24,6 +24,7 @@ add_llvm_library(LLVMBOLTCore ParallelUtilities.cpp Relocation.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB LINK_LIBS ${LLVM_PTHREAD_LIB} ) diff --git a/bolt/lib/Passes/CMakeLists.txt b/bolt/lib/Passes/CMakeLists.txt index c9cb7eb..544b6df 100644 --- a/bolt/lib/Passes/CMakeLists.txt +++ b/bolt/lib/Passes/CMakeLists.txt @@ -45,6 +45,8 @@ add_llvm_library(LLVMBOLTPasses VeneerElimination.cpp RetpolineInsertion.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + LINK_LIBS ${LLVM_PTHREAD_LIB} diff --git a/bolt/lib/Profile/CMakeLists.txt b/bolt/lib/Profile/CMakeLists.txt index f4397e3..0b5d771 100644 --- a/bolt/lib/Profile/CMakeLists.txt +++ b/bolt/lib/Profile/CMakeLists.txt @@ -7,6 +7,8 @@ add_llvm_library(LLVMBOLTProfile YAMLProfileReader.cpp YAMLProfileWriter.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + LINK_COMPONENTS Support ) diff --git a/bolt/lib/Rewrite/CMakeLists.txt b/bolt/lib/Rewrite/CMakeLists.txt index 053fa9a..e411c50 100644 --- a/bolt/lib/Rewrite/CMakeLists.txt +++ b/bolt/lib/Rewrite/CMakeLists.txt @@ -33,6 +33,8 @@ add_llvm_library(LLVMBOLTRewrite MachORewriteInstance.cpp RewriteInstance.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + LINK_LIBS ${LLVM_PTHREAD_LIB} ) diff --git a/bolt/lib/RuntimeLibs/CMakeLists.txt b/bolt/lib/RuntimeLibs/CMakeLists.txt index f0359a6..26c2109 100644 --- a/bolt/lib/RuntimeLibs/CMakeLists.txt +++ b/bolt/lib/RuntimeLibs/CMakeLists.txt @@ -10,6 +10,8 @@ add_llvm_library(LLVMBOLTRuntimeLibs RuntimeLibrary.cpp HugifyRuntimeLibrary.cpp InstrumentationRuntimeLibrary.cpp + + DISABLE_LLVM_LINK_LLVM_DYLIB ) target_link_libraries(LLVMBOLTRuntimeLibs diff --git a/bolt/lib/Target/AArch64/CMakeLists.txt b/bolt/lib/Target/AArch64/CMakeLists.txt index 2975396..be03e24 100644 --- a/bolt/lib/Target/AArch64/CMakeLists.txt +++ b/bolt/lib/Target/AArch64/CMakeLists.txt @@ -7,6 +7,8 @@ set(LLVM_LINK_COMPONENTS add_llvm_library(LLVMBOLTTargetAArch64 AArch64MCPlusBuilder.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + DEPENDS AArch64CommonTableGen ) diff --git a/bolt/lib/Target/X86/CMakeLists.txt b/bolt/lib/Target/X86/CMakeLists.txt index 7be9f80..2b769bc 100644 --- a/bolt/lib/Target/X86/CMakeLists.txt +++ b/bolt/lib/Target/X86/CMakeLists.txt @@ -9,6 +9,8 @@ add_llvm_library(LLVMBOLTTargetX86 X86MCPlusBuilder.cpp X86MCSymbolizer.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + DEPENDS X86CommonTableGen ) diff --git a/bolt/lib/Utils/CMakeLists.txt b/bolt/lib/Utils/CMakeLists.txt index 2a13077..9ed9be6 100644 --- a/bolt/lib/Utils/CMakeLists.txt +++ b/bolt/lib/Utils/CMakeLists.txt @@ -2,6 +2,8 @@ add_llvm_library(LLVMBOLTUtils CommandLineOpts.cpp Utils.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + LINK_LIBS ${LLVM_PTHREAD_LIB} diff --git a/bolt/tools/bat-dump/CMakeLists.txt b/bolt/tools/bat-dump/CMakeLists.txt index b7a7c45..71d4f3e 100644 --- a/bolt/tools/bat-dump/CMakeLists.txt +++ b/bolt/tools/bat-dump/CMakeLists.txt @@ -5,6 +5,8 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(llvm-bat-dump bat-dump.cpp + + DISABLE_LLVM_LINK_LLVM_DYLIB ) target_link_libraries(llvm-bat-dump diff --git a/bolt/tools/driver/CMakeLists.txt b/bolt/tools/driver/CMakeLists.txt index e56be15..1c59619 100644 --- a/bolt/tools/driver/CMakeLists.txt +++ b/bolt/tools/driver/CMakeLists.txt @@ -14,6 +14,8 @@ endif() add_bolt_tool(llvm-bolt llvm-bolt.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + DEPENDS ${BOLT_DRIVER_DEPS} ) diff --git a/bolt/tools/heatmap/CMakeLists.txt b/bolt/tools/heatmap/CMakeLists.txt index cb8e7ee..9f52ddb 100644 --- a/bolt/tools/heatmap/CMakeLists.txt +++ b/bolt/tools/heatmap/CMakeLists.txt @@ -7,6 +7,7 @@ set(LLVM_LINK_COMPONENTS add_bolt_tool(llvm-bolt-heatmap heatmap.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB ) target_link_libraries(llvm-bolt-heatmap diff --git a/bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt b/bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt index f84a841..f21285f 100644 --- a/bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt +++ b/bolt/tools/llvm-bolt-fuzzer/CMakeLists.txt @@ -4,6 +4,8 @@ set(LLVM_LINK_COMPONENTS add_llvm_fuzzer(llvm-bolt-fuzzer llvm-bolt-fuzzer.cpp + + DISABLE_LLVM_LINK_LLVM_DYLIB ) if (TARGET llvm-bolt-fuzzer) diff --git a/bolt/tools/merge-fdata/CMakeLists.txt b/bolt/tools/merge-fdata/CMakeLists.txt index 08b2e65..4bd2b52 100644 --- a/bolt/tools/merge-fdata/CMakeLists.txt +++ b/bolt/tools/merge-fdata/CMakeLists.txt @@ -3,6 +3,8 @@ set(LLVM_LINK_COMPONENTS Support) add_bolt_tool(merge-fdata merge-fdata.cpp + DISABLE_LLVM_LINK_LLVM_DYLIB + DEPENDS intrinsics_gen ) diff --git a/bolt/unittests/Core/CMakeLists.txt b/bolt/unittests/Core/CMakeLists.txt index 0e78d0a..15d48f2 100644 --- a/bolt/unittests/Core/CMakeLists.txt +++ b/bolt/unittests/Core/CMakeLists.txt @@ -9,6 +9,8 @@ add_bolt_unittest(CoreTests BinaryContext.cpp MCPlusBuilder.cpp DynoStats.cpp + + DISABLE_LLVM_LINK_LLVM_DYLIB ) target_link_libraries(CoreTests diff --git a/bolt/unittests/Profile/CMakeLists.txt b/bolt/unittests/Profile/CMakeLists.txt index b0f1ec0..e0aa092 100644 --- a/bolt/unittests/Profile/CMakeLists.txt +++ b/bolt/unittests/Profile/CMakeLists.txt @@ -1,5 +1,7 @@ add_bolt_unittest(ProfileTests DataAggregator.cpp + + DISABLE_LLVM_LINK_LLVM_DYLIB ) target_link_libraries(ProfileTests -- 2.7.4