[llvm] ee2d2bd - [lllvm] add Passes to LLVM_LINK_COMPONENTS for LLVMMCATests (#145617)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 08:48:45 PDT 2025
Author: Andrew Rogers
Date: 2025-07-08T08:48:42-07:00
New Revision: ee2d2bda71fcb4cf65f9f2dbca2d72132ea7e880
URL: https://github.com/llvm/llvm-project/commit/ee2d2bda71fcb4cf65f9f2dbca2d72132ea7e880
DIFF: https://github.com/llvm/llvm-project/commit/ee2d2bda71fcb4cf65f9f2dbca2d72132ea7e880.diff
LOG: [lllvm] add Passes to LLVM_LINK_COMPONENTS for LLVMMCATests (#145617)
## Purpose
Add `Passes` to `LLVM_LINK_COMPONENTS` for `LLVMMCATests` so that it
links properly when LLVM is built as a Windows DLL.
## Background
`LLVPasses` appears to be a missing dependency from `LLVMMCATests`, but
when LLVM is built statically it picks-up the required `LLVMPasses`
symbols from a transitive dependency (presumably). When LLVM is built as
a Windows DLL, `LLVMMCATests` fails to link 4 symbols from `LLVMPasses`
without this change:
```
LLVMX86CodeGen.lib(X86CodeGenPassBuilder.cpp.obj) : error LNK2019: unresolved external symbol "public: __cdecl llvm::ModuleInlinerWrapperPass::ModuleInlinerWrapperPass(struct llvm::InlineParams,bool,struct llvm::InlineContext,enum llvm::InliningAdvisorMode,unsigned int)" (??0ModuleInlinerWrapperPass at llvm@@QEAA at UInlineParams@1 at _NUInlineContext@1 at W4InliningAdvisorMode@1 at I@Z) referenced in function "public: void __cdecl llvm::ModuleInlinerWrapperPass::`default constructor closure'(void)" (??_FModuleInlinerWrapperPass at llvm@@QEAAXXZ)
LLVMX86CodeGen.lib(X86CodeGenPassBuilder.cpp.obj) : error LNK2019: unresolved external symbol "public: __cdecl llvm::PipelineTuningOptions::PipelineTuningOptions(void)" (??0PipelineTuningOptions at llvm@@QEAA at XZ) referenced in function "public: void __cdecl llvm::PassBuilder::`default constructor closure'(void)" (??_FPassBuilder at llvm@@QEAAXXZ)
LLVMX86CodeGen.lib(X86CodeGenPassBuilder.cpp.obj) : error LNK2019: unresolved external symbol "public: __cdecl llvm::PassBuilder::PassBuilder(class llvm::TargetMachine *,class llvm::PipelineTuningOptions,class std::optional<struct llvm::PGOOptions>,class llvm::PassInstrumentationCallbacks *)" (??0PassBuilder at llvm@@QEAA at PEAVTargetMachine@1 at VPipelineTuningOptions@1 at V?$optional at UPGOOptions@llvm@@@std@@PEAVPassInstrumentationCallbacks at 1@@Z) referenced in function "public: void __cdecl llvm::PassBuilder::`default constructor closure'(void)" (??_FPassBuilder at llvm@@QEAAXXZ)
LLVMX86CodeGen.lib(X86InsertPrefetch.cpp.obj) : error LNK2019: unresolved external symbol "public: __cdecl llvm::SampleProfileLoaderPass::SampleProfileLoaderPass(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,enum llvm::ThinOrFullLTOPhase,class llvm::IntrusiveRefCntPtr<class llvm::vfs::FileSystem>,bool,bool)" (??0SampleProfileLoaderPass at llvm@@QEAA at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@0W4ThinOrFullLTOPhase at 1@V?$IntrusiveRefCntPtr at VFileSystem@vfs at llvm@@@1 at _N3@Z) referenced in function "public: void __cdecl llvm::SampleProfileLoaderPass::`default constructor closure'(void)" (??_FSampleProfileLoaderPass at llvm@@QEAAXXZ)
unittests\tools\llvm-mca\LLVMMCATests.exe : fatal error LNK1120: 4 unresolved externals
```
## Validation
Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:
- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang
Added:
Modified:
llvm/unittests/tools/llvm-mca/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/unittests/tools/llvm-mca/CMakeLists.txt b/llvm/unittests/tools/llvm-mca/CMakeLists.txt
index 9c69509b4b54d..26b00f8f1fd73 100644
--- a/llvm/unittests/tools/llvm-mca/CMakeLists.txt
+++ b/llvm/unittests/tools/llvm-mca/CMakeLists.txt
@@ -1,6 +1,7 @@
set(LLVM_LINK_COMPONENTS
MC
MCA
+ Passes
Support
TargetParser
)
More information about the llvm-commits
mailing list