Skip to content

fix: make static archives independent of the final linker setting - #711

Open
cerisier wants to merge 1 commit into
mainfrom
cerisier/zig-static-archive-link-setting
Open

cerisier wants to merge 1 commit into
mainfrom
cerisier/zig-static-archive-link-setting

Conversation

@cerisier

@cerisier cerisier commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

use_cc_common_link selects the final linker for Zig binaries, tests, and shared libraries. A static library always uses zig build-lib, but the setting used to change the inputs and flags for that action.

Before

  • With the setting off, rules_zig passed native dependency libraries and linker flags from CcInfo to Zig.
  • With the setting on, rules_zig skipped those inputs and injected -lc and -fcompiler-rt. That could change both how Zig compiled the sources and which runtime code ended up in the archive.

After

Static archives use the former off path under either setting. Declared dependency flags still reach Zig, including -lc from the :libc helper. The final linker setting no longer controls libc or compiler-rt for the archive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant