[Comgr] Select static LLVM components independently of LLVM's default linkage - #3915
Open
martin-luecke wants to merge 1 commit into
Open
[Comgr] Select static LLVM components independently of LLVM's default linkage#3915martin-luecke wants to merge 1 commit into
martin-luecke wants to merge 1 commit into
Conversation
martin-luecke
force-pushed
the
users/mluecke/comgr-static-closure-2927
branch
from
August 14, 2026 12:02
22249e4 to
2499e97
Compare
Add a consumer-selectable static LLVM component interface to static libraries created through add_llvm_library, while direct llvm_add_library users opt in. Consumers that do not select it keep their configured libLLVM linkage. Clang and LLD opt in through their library helpers because they call llvm_add_library directly. Have COMGR_STATIC_LLVM select this interface on the final shared library and capture COMGR's effective LLVM and Clang linkage independently of repeated package discovery. This embeds the complete static LLVM, Clang, and LLD closure, including external libraries built through add_llvm_library, without changing the producer-wide default for other consumers. This addresses #2927.
martin-luecke
force-pushed
the
users/mluecke/comgr-static-closure-2927
branch
from
August 14, 2026 16:45
2499e97 to
fc38256
Compare
lamb-j
requested changes
Aug 14, 2026
lamb-j
left a comment
Collaborator
There was a problem hiding this comment.
The LLVM side changes need to go upstream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When LLVM is configured to link consumers against
libLLVM, the exported Clang and LLD static targets still carrylibLLVMin their link interfaces. ChangingLLVM_LINK_LLVM_DYLIBlater in COMGR therefore cannot produce a complete static compiler closure.Teach
llvm_add_libraryto expose a consumer-selectable static component interface alongside the normallibLLVMinterface.COMGR_STATIC_LLVMselects that interface for the sharedamd_comgrtarget and records COMGR's effective LLVM and Clang linkage without mutating package-wide variables. Normal LLVM, Clang, and LLD consumers retain their configured dylib linkage, while shared COMGR embeds the required LLVM, Clang, and LLD archives without depending onlibLLVMorlibclang-cpp.I verified build-tree and installed-package consumption, the default dylib-linked COMGR configuration, a TheRock-equivalent configuration, and integration with #3720. The resulting
libamd_comgr.soloads directly, exports only the COMGR API, and has nolibLLVMorlibclang-cppDT_NEEDEDentries or unresolved LLVM, Clang, or LLD symbols.Addresses #2927.