feat: implement test-obj for use_cc_common_link in zig 0.16#647
Open
cerisier wants to merge 2 commits intoaherrmann:mainfrom
Open
feat: implement test-obj for use_cc_common_link in zig 0.16#647cerisier wants to merge 2 commits intoaherrmann:mainfrom
cerisier wants to merge 2 commits intoaherrmann:mainfrom
Conversation
cerisier
commented
May 7, 2026
| def _object_extension(os): | ||
| return ".obj" if os == "windows" else ".o" | ||
|
|
||
| def _supports_test_obj(zig_version): |
Contributor
Author
There was a problem hiding this comment.
Can this be replaced by semver ?
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.
As of zig-0.16, it is now possible to use test-obj to produce a machine code object for the test.
It is also important to support that because there are setups where producing a .bc and handing it over the zig doesn't work.
For instance, when bootstrapping zig, and using a dedicated cc toolchain, one might want to save build cycles and not build zig with
clangsupport at all. In which case,zig ccdoesn't work.It is a niche usecase but important when supporting the
new chipstory.This is already the right way to do this in zig 0.16 anyway.
Additionally, there is a bug in
zig test-objwhen passing-lcor-fcompiler-rtbecause LLVM does allow__stack_chk_failto be an alias. We circumvent this by passing-fno-stack-protectorwhentest-objwill be used.