-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Handling of linker flags appears to have changed from 1.60 to 1.61 #97196
Comments
I believe this is expected. The order of the two lines is indeed wrong; the problem is just masked before 1.61. |
That seems reasonable, though it is a regression. May be worth updating the release notes to mention this change in behavior if it's expected and desired? |
This is potentially related other issues related to order of link arguments in #96328 and rust-lang/cargo#10600. |
Any chance this is causing the issue I just encountered in #97198? |
This is already in release notes, the first compatibility note in https://github.com/rust-lang/rust/blob/stable/RELEASES.md#compatibility-notes. |
@BGR360
|
Clearly I'm bad at a reading! Sorry for the noise 😅 |
rustc appears to have changed the flags it passes to the linker, which has made the order of
-l
flags significant in a way that they were not before.Code
First, steps to set up a Cargo project to replicate the problem:
With Rust 1.60.0 installed, this builds and runs fine (
cargo b; cargo r
).With Rust 1.61.0 installed, the build errors with:
Flipping the order of the
cc
invocation and theprintln!
inbuild.rs
fixes the build.Looking at the output with
--verbose
, therustc
command that cargo invokes appears to be identical (except for different hashes). UsingRUSTC_LOG=rustc_codegen_ssa::back::link=info
to get the underlying linker archive, it appears thatrustc
changed the arguments it passes to the linker under the hood:Why exactly this causes the crate to stop compiling when it did previously, I'm not entirely sure, but it is a regression. Flipping the two invocations in
build.rs
has the effect of flipping the order of the-l static=test
and-l static=foo
arguments that Cargo passes torustc
, which in turn makes the linker invocation succeed.Version it worked on
It most recently worked on: 1.60.0
Version with regression
rustc --version --verbose
:The most likely culprit for this appears to be #93901, so cc @petrochenkov.
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: