Auto merge of #116014 - lqd:mcp510-2-electric-boogaloo, r=petrochenkov
Implement `-Clink-self-contained=-linker` opt out This implements the `-Clink-self-contained` opt out necessary to switch to lld by changing rustc's defaults instead of cargo's. Components that are enabled and disabled on the CLI are recorded, for the purpose of being merged with the ones which the target spec will declare (I'll open another PR for that tomorrow, for easier review). For MCP510, we now check whether using the self-contained linker is disabled on the CLI. Right now it would only be sensible to with `-Zgcc-ld=lld` (and I'll add some checks that we don't both enable and disable a component on the CLI in a future PR), but the goal is to simplify adding the check of the target's enabled components here in the follow-up PRs. r? `@petrochenkov`
This commit is contained in:
commit
5aa23be6b6
10 changed files with 159 additions and 64 deletions
|
@ -2978,8 +2978,9 @@ fn add_lld_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
|
|||
}
|
||||
|
||||
// 1. Implement the "self-contained" part of this feature by adding rustc distribution
|
||||
// directories to the tool's search path.
|
||||
if sess.opts.cg.link_self_contained.linker() {
|
||||
// directories to the tool's search path:
|
||||
// - if the self-contained linker is enabled on the CLI.
|
||||
if sess.opts.cg.link_self_contained.is_linker_enabled() {
|
||||
for path in sess.get_tools_search_paths(false) {
|
||||
cmd.arg({
|
||||
let mut arg = OsString::from("-B");
|
||||
|
@ -2990,7 +2991,7 @@ fn add_lld_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
|
|||
}
|
||||
|
||||
// 2. Implement the "linker flavor" part of this feature by asking `cc` to use some kind of
|
||||
// `lld` as the linker.
|
||||
// `lld` as the linker.
|
||||
cmd.arg("-fuse-ld=lld");
|
||||
|
||||
if !flavor.is_gnu() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue