Skip to content

Conversation

jurahul
Copy link
Contributor

@jurahul jurahul commented Aug 26, 2025

Add BinaryFormat to LINK_COMPONENTS to fix the following linker error:

ld.lld: error: undefined symbol: llvm::dxbc::getRootParameterTypes()
>>> referenced by DXILRootSignature.cpp
>>>               lib/Target/DirectX/CMakeFiles/LLVMDirectXCodeGen.dir/DXILRootSignature.cpp.o:(llvm::dxil::RootSignatureAnalysisPrinter::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&))

ld.lld: error: undefined symbol: llvm::dxbc::getShaderVisibility()
>>> referenced by DXILRootSignature.cpp
>>>               lib/Target/DirectX/CMakeFiles/LLVMDirectXCodeGen.dir/DXILRootSignature.cpp.o:(llvm::dxil::RootSignatureAnalysisPrinter::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&))
>>> referenced by DXILRootSignature.cpp
>>>               lib/Target/DirectX/CMakeFiles/LLVMDirectXCodeGen.dir/DXILRootSignature.cpp.o:(llvm::dxil::RootSignatureAnalysisPrinter::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&))

Root cause: #154249 changed a header-only dependency to a real dependency without noticing that the dependency was missing in CMakeLists.txt

Add `BinaryFormat` to `LINK_COMPONENTS` to fix linker error finding
symbols `llvm::dxbc::getRootParameterTypes` and
`llvm::dxbc::getShaderVisibility`
@jurahul
Copy link
Contributor Author

jurahul commented Aug 26, 2025

Linux CI is the ongoing LLDB test failures and unrelated to this change

@jurahul
Copy link
Contributor Author

jurahul commented Aug 26, 2025

I suspect the failure is specific to building with shared libs

@jurahul jurahul marked this pull request as ready for review August 26, 2025 16:49
@llvmbot
Copy link
Member

llvmbot commented Aug 26, 2025

@llvm/pr-subscribers-backend-directx

Author: Rahul Joshi (jurahul)

Changes

Add BinaryFormat to LINK_COMPONENTS to fix linker error finding symbols llvm::dxbc::getRootParameterTypes and
llvm::dxbc::getShaderVisibility


Full diff: https://github.com/llvm/llvm-project/pull/155441.diff

1 Files Affected:

  • (modified) llvm/lib/Target/DirectX/CMakeLists.txt (+1)
diff --git a/llvm/lib/Target/DirectX/CMakeLists.txt b/llvm/lib/Target/DirectX/CMakeLists.txt
index 8100f941c8d94..6c079517e22d6 100644
--- a/llvm/lib/Target/DirectX/CMakeLists.txt
+++ b/llvm/lib/Target/DirectX/CMakeLists.txt
@@ -41,6 +41,7 @@ add_llvm_target(DirectXCodeGen
   LINK_COMPONENTS
   Analysis
   AsmPrinter
+  BinaryFormat
   CodeGen
   CodeGenTypes
   Core

@jurahul jurahul requested a review from inbelic August 26, 2025 17:01
Copy link
Contributor

@inbelic inbelic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. Maybe you could update the commit message to include where it was found and the reason:

The DirectX backend incorrectly did not specify it's dependency on BinaryFormat as it was a header only dependency and so it did not cause any build failures.

@jurahul
Copy link
Contributor Author

jurahul commented Aug 26, 2025

Thanks, updated the commit message with the failure seen and the root cause (that @bogner mentioned in #154249).

@jurahul jurahul merged commit 4a4b810 into llvm:main Aug 26, 2025
13 of 14 checks passed
@jurahul jurahul deleted the fix_dx_link_error branch August 26, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants