-
Notifications
You must be signed in to change notification settings - Fork 2.7k
test(build-std): Add test for LTO #16277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind briefly explaining (or copy) the regression a bit in the PR description as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also be helpful to have a code comment around the test, as the test has a bit of distance from Cargo itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing the context!
a32e55d to
374368d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing the context!
Update cargo submodule 7 commits in 5c0343317ce45d2ec17ecf41eaa473a02d73e29c..9fa462fe3a81e07e0bfdcc75c29d312c55113ebb 2025-11-18 19:05:44 +0000 to 2025-11-21 20:49:51 +0000 - Enable CARGO_CFG_DEBUG_ASSERTIONS in build scripts based on profile (rust-lang/cargo#16160) - fix(config-include): disallow glob and template syntax (rust-lang/cargo#16285) - test(config-include): include always relative to including config (rust-lang/cargo#16286) - docs(guide): When suggesting alt dev profile, link to related issue (rust-lang/cargo#16275) - refactor(timings): separate data collection and presentation (rust-lang/cargo#16282) - test(build-std): Add test for LTO (rust-lang/cargo#16277) - fix(bindeps): do not propagate artifact dependency to proc macro or build deps (rust-lang/cargo#15788) r? ghost
Add a test for rust-lang/rust#146133.
cargo +nightly-2025-08-29 test --test build-std -- ltocan reproduce the regression.This is not a bug from Cargo, but it requires
-Zbuild-stdin most use cases.The test case is from rust-lang/rust#146109. The point is that when rustc is invoked with -Clto=fat or -Clto=thin, it should perform LTO with ALL bitcodes. However, rust-lang/rust#145368 emits bitcodes for compiler_builtins but excludes it from LTO participation.
As a result, the compiler_builtins bitcodes library is passed to the linker, but the linkers, such as the GNU ld or older versions of LLD, are unable to process bitcodes.