-
Notifications
You must be signed in to change notification settings - Fork 175
[RFC] recommend rust-lld as the default linker #39
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
Comments
Seems fine to recommend lld as the default choice, especially with rust-embedded/cortex-m-rt#84 landed, and just mention in the docs (and the .cargo/config comments) how to use gcc instead and why you might want to. |
+1 |
Am I missing something? I just removed the linker from my cargo config and it compiled just fine. What is preventing us from making the change now? |
@therealprof the |
@japaric I misunderstood your proposal then: I thought rust-lld is the default now and we're recommending using gcc/binutils for linking. What is preventing us from using rust-lld as default? |
@therealprof sorry, I think the RFC title could be more precise: "use rust-lld as the default linker". For the The proposal is to have a future quickstart release change the linker to rust-lld using .cargo/config. That means that if you clone quickstart and run
Changing the linker requires passing |
Sorry for being so imprecise. I meant: What is preventing |
Changing the default linker of any of the (*) However, everyone who can build a binary is using nightly so it might be OK to do this breaking change without breaking Rust stability promise ("no breaking changes when doing updates on the stable channel). But, I imagine such change would require a rust-lang/rust RFC and getting an OK from all stakeholders. Also, there would need to be a stable mechanism to switch from |
If we don't change it for Rust 2018 edition we'll be stuck with it forever (as approximation for "a long time"). I'd rather break it now instead of having to work around it for the foreseeable future. Unless of course a smarter mechanism is around the corner (*). Fun fact: I've been using the binutils linker directly all the time (instead of going through gcc) and so the arguments to pass are exactly the same. (*) Like introspecting the linker args and inferring which linker to use. |
@alexcrichton what would it take (RFC or PR+FCP) to change the default linker of a built-in target? This is technically a breaking change but in this case the change would only break nightly users. More details in #39 (comment). |
An interesting question! It does sound unfortunatley like it'd be a breaking change, so in that sense to do this I think we'd just want to have a concrete handle on what exactly the breakage is (which it sounds like you've got) along with stakeholder buy-in that the breakage is worth it and/or there's a migration path. In that sense this I think it's up to you whether it requires an RFC or not. The embedded working group likely embodies all the stakeholders here so if there's consenus to do this then it can likely be a PR! A few things I've found helpful for things like this in the past are:
Does that make sense? |
41: use LLD as the default linker r=therealprof,korken89 a=japaric closes #39 I added instructions on how to switch to a different linker to .cargo/config but I don't think that's too visible. Beginners are unlikely to look into that file if they run into problems with the default linker. Any suggestions to improve the visibility of that information? Also, don't merge this until the default linker changes for the Cortex-M targets on nightly as this relies on that change. r? @rust-embedded/cortex-m Co-authored-by: Jorge Aparicio <[email protected]>
41: use LLD as the default linker r=therealprof a=japaric closes #39 I added instructions on how to switch to a different linker to .cargo/config but I don't think that's too visible. Beginners are unlikely to look into that file if they run into problems with the default linker. Any suggestions to improve the visibility of that information? Also, don't merge this until the default linker changes for the Cortex-M targets on nightly as this relies on that change. r? @rust-embedded/cortex-m Co-authored-by: Jorge Aparicio <[email protected]>
once the unstable flag
-Z linker-flavor
is not requiredAdvantages:
arm-none-eabi-gcc
to build binaries.Disadvantages:
cc @rust-embedded/cortex-m
The text was updated successfully, but these errors were encountered: