[llvm] 0dcf924 - [llvm] add ProfileData to yaml2obj and obj2yaml LLVM_LINK_COMPONENTS (#147344)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 08:49:20 PDT 2025


Author: Andrew Rogers
Date: 2025-07-08T08:49:17-07:00
New Revision: 0dcf924f37269295b505a16176008503159b9860

URL: https://github.com/llvm/llvm-project/commit/0dcf924f37269295b505a16176008503159b9860
DIFF: https://github.com/llvm/llvm-project/commit/0dcf924f37269295b505a16176008503159b9860.diff

LOG: [llvm] add ProfileData to yaml2obj and obj2yaml LLVM_LINK_COMPONENTS (#147344)

## Purpose
Add `ProfileData` to `LLVM_LINK_COMPONENTS` for the `yaml2obj` and
`obj2yaml` tools so they link properly when LLVM is built as a Windows
DLL.

## Background
`ProfileData` appears to be a missing dependency from `yaml2obj` and
`obj2yaml`, 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, `yaml2obj` and `obj2yaml` fail to link 3
symbols from `ProfileData` without this change:

```
LLVMCore.lib(Verifier.cpp.obj) : error LNK2019: unresolved external symbol "class std::error_category const & __cdecl llvm::instrprof_category(void)" (?instrprof_category at llvm@@YAAEBVerror_category at std@@XZ) referenced in function "public: virtual class std::error_code __cdecl llvm::InstrProfError::convertToErrorCode(void)const " (?convertToErrorCode at InstrProfError@llvm@@UEBA?AVerror_code at std@@XZ)
LLVMCore.lib(Verifier.cpp.obj) : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl llvm::InstrProfError::message(void)const " (?message at InstrProfError@llvm@@UEBA?AV?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@XZ)
LLVMCore.lib(Verifier.cpp.obj) : error LNK2019: unresolved external symbol "public: static char llvm::InstrProfError::ID" (?ID at InstrProfError@llvm@@2DA) referenced in function "void __cdecl llvm::handleAllErrors<class `public: static struct std::pair<enum llvm::instrprof_error,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > __cdecl llvm::InstrProfError::take(class llvm::Error)'::`2'::<lambda_1> >(class llvm::Error,class `public: static struct std::pair<enum llvm::instrprof_error,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > __cdecl llvm::InstrProfError::take(class llvm::Error)'::`2'::<lambda_1> &&)" (??$handleAllErrors at V<lambda_1>@?1??take at InstrProfError@llvm@@SA?AU?$pair at W4instrprof_error@llvm@@V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@std@@VError at 4@@Z@@llvm@@YAXVError at 0@$$QEAV<lambda_1>@?1??take at InstrProfError@0 at SA?AU?$pair at W4instrprof_error@llvm@@V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@std@@0 at Z@@Z)
bin\yaml2obj.exe : fatal error LNK1120: 3 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/tools/obj2yaml/CMakeLists.txt
    llvm/tools/yaml2obj/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/tools/obj2yaml/CMakeLists.txt b/llvm/tools/obj2yaml/CMakeLists.txt
index ac8ff8c85dd9c..fef0ecc220c87 100644
--- a/llvm/tools/obj2yaml/CMakeLists.txt
+++ b/llvm/tools/obj2yaml/CMakeLists.txt
@@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
   DebugInfoDWARF
   Object
   ObjectYAML
+  ProfileData
   Support
   )
 

diff  --git a/llvm/tools/yaml2obj/CMakeLists.txt b/llvm/tools/yaml2obj/CMakeLists.txt
index 4a10ec851587d..ad413405255c6 100644
--- a/llvm/tools/yaml2obj/CMakeLists.txt
+++ b/llvm/tools/yaml2obj/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS
   Object
   ObjectYAML
+  ProfileData
   Support
   )
 


        


More information about the llvm-commits mailing list