enable PIC for multi-versioned objects when targeting shared libraries#1
Merged
ATTron merged 2 commits intoATTron:mainfrom Apr 15, 2026
Merged
enable PIC for multi-versioned objects when targeting shared libraries#1ATTron merged 2 commits intoATTron:mainfrom
ATTron merged 2 commits intoATTron:mainfrom
Conversation
ATTron
reviewed
Apr 14, 2026
Owner
ATTron
left a comment
There was a problem hiding this comment.
Hey, thanks for this :) great catch and clean fix!
Tested locally on macOS aarch64 (Zig 0.16.0). Build and tests pass. The example hits a PIC error, but that's already broken on main so not from your PR :)
One thing — compile.linkage == .dynamic misses platforms like macOS/aarch64 where PIC is required for everything. Swapping to compile.root_module.pic inherits what Zig already decided for the parent, covering both cases. Tested and the example runs clean after that ( i should probably make it CI tbh but another task for another day )
I'll push the tweak onto your branch. Thanks for helping out!
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.
addMultiVersionobjects don't inherit PIC from the parent compile step. When linking into a dynamic library, the linker fails with R_X86_64_32S relocation cannot be used against local symbol. This auto-detectscompile.linkage == .dynamicand sets.pic = trueon both the user and wrapper modules, with an explicit override option.