[llvm] 587bdb3 - [llvm][cmake] never link llvm-config against llvm dylib
John Ericson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 09:34:49 PST 2022
Author: sternenseemann
Date: 2022-01-04T17:34:44Z
New Revision: 587bdb3772333763dd739021cd08bc44bcd8485d
URL: https://github.com/llvm/llvm-project/commit/587bdb3772333763dd739021cd08bc44bcd8485d
DIFF: https://github.com/llvm/llvm-project/commit/587bdb3772333763dd739021cd08bc44bcd8485d.diff
LOG: [llvm][cmake] never link llvm-config against llvm dylib
When cross-compiling, in order to make the output of the native and
cross-compiled llvm-config match, one needs to re-pass all cmake flags
relevant to BuildVariables.inc via `CROSS_TOOLCHAIN_FLAGS_NATIVE`. If
`LLVM_LINK_LLVM_DYLIB=ON` is among those, building a full `libLLVM` shared
object is required for the native llvm-config, otherwise `--shared-mode`
will be incorrect and `--link-shared` broken.
To avoid this, we can make llvm-config link statically against the
needed components for simplicity's sake in both the native and cross
case.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D116537
Added:
Modified:
llvm/tools/llvm-config/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/tools/llvm-config/CMakeLists.txt b/llvm/tools/llvm-config/CMakeLists.txt
index 1b74355a42099..aa5aa20257f9f 100644
--- a/llvm/tools/llvm-config/CMakeLists.txt
+++ b/llvm/tools/llvm-config/CMakeLists.txt
@@ -6,6 +6,12 @@ set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc)
# Add the llvm-config tool.
add_llvm_tool(llvm-config
llvm-config.cpp
+ # This utility doesn't use much of LLVM, so linking a shared library for the
+ # entire thing is overkill. Avoiding that especially saves on build time when cross
+ # compiling LLVM and building both cross and native `llvm-config`s. We don't
+ # want to build an entire native libLLVM.so in addition to the cross one just
+ # for the native `llvm-config`!
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
# Compute the substitution values for various items.
More information about the llvm-commits
mailing list