Repository navigation
Allow building dxc as a static lib - #9161
Draft
Inner Daemons (inner-daemons) wants to merge 2 commits into
Draft
Inner Daemons (inner-daemons) wants to merge 2 commits into
Inner Daemons (inner-daemons) wants to merge 2 commits into
Conversation
Adds an opt-in dxcompiler_static target built from the same sources as dxcompiler (minus the DLL .rc/.def). In the static build, DXC_STATIC_LIB replaces DllMain / the ELF constructor with one-time initialization on the first DxcCreateInstance(2) call, does not export symbols, and does not replace the global operator new on Windows. Adds DxcStaticTests, a gtest binary that links dxcompiler_static directly (no dlopen/LoadLibrary) and covers DXIL and SPIR-V compilation, disassembly, validation, error reporting, a custom IMalloc, and concurrent first-time initialization. Refs microsoft#4766 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0139G8ioEBLWcwJijh7gvZhz
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
DxcOptimizer.cpp calls pass initializers from IPO and ScalarOpts and the pass printer factories from PassPrinters, but LLVMHLSL did not declare those libraries. The shared dxcompiler happened to link because of the order of its own link line; linking dxcompiler_static into an executable failed with undefined references. Also apply clang-format. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0139G8ioEBLWcwJijh7gvZhz
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
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.
Closes #4766
We've wanted this for a while in https://github.com/gfx-rs/wgpu/ for example. So much so in fact that we've relied on using a DXC fork to get static library builds. But if dxc could compile into a static library itself that would be vastly preferred.
The PR's code is LLM generated. Before I take it out of draft I will review it + write my own full description.
If this isn't desired for dxc it can quickly be closed, I won't be too bothered.
Let me know of any other concerns. Thanks
LLM-written description below