Skip to content

Filter ignored linker optimization flag before invoking Zig - #486

Merged
messense merged 1 commit into
rust-cross:mainfrom
giIuis:fix/ignored-linker-optimization
Sep 25, 2026
Merged

messense merged 1 commit into
rust-cross:mainfrom
giIuis:fix/ignored-linker-optimization

Conversation

@giIuis

@giIuis giIuis commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Rust automatically passes -Wl,-O1 during optimized builds. cargo-zigbuild forwards it to zig cc, which ignores the option and emits a warning.
This argument should be filtered to avoid noisy release builds, since the warning doesn't provide any gain whatsoever.

Addresses #483.

@heidrickla

Copy link
Copy Markdown

Tested on Windows with rustc 1.98.1 and Zig 0.16.0, applied to fcc8f30. The warning is gone for x86_64- and aarch64-unknown-linux-musl, and the release binaries are byte-identical with and without -Wl,-O1.

@messense
messense merged commit d9f7fd3 into rust-cross:main Sep 25, 2026
49 checks passed
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.

3 participants