Skip to content

Commit 793c8e6

Browse files
committed
tmp: turn rust-lld on
1 parent 5dac6b3 commit 793c8e6

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

compiler/rustc_session/src/config.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,17 @@ impl LinkSelfContained {
308308
on
309309
}
310310

311+
pub fn with_linker() -> Self {
312+
let mut link_self_contained = LinkSelfContained::default();
313+
link_self_contained.components.insert(LinkSelfContainedComponents::LINKER);
314+
link_self_contained
315+
}
316+
311317
/// To help checking CLI usage while some of the values are unstable: returns whether one of the
312318
/// components was set individually. This would also require the `-Zunstable-options` flag, to
313319
/// be allowed.
314320
fn are_unstable_variants_set(&self) -> bool {
315-
let any_component_set = !self.components.is_empty();
316-
self.explicitly_set.is_none() && any_component_set
321+
false
317322
}
318323

319324
/// Returns whether the self-contained linker component is enabled.

compiler/rustc_session/src/options.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1310,12 +1310,23 @@ options! {
13101310
#[rustc_lint_opt_deny_field_access("use `Session::link_dead_code` instead of this field")]
13111311
link_dead_code: Option<bool> = (None, parse_opt_bool, [TRACKED],
13121312
"keep dead code at link time (useful for code coverage) (default: no)"),
1313-
link_self_contained: LinkSelfContained = (LinkSelfContained::default(), parse_link_self_contained, [UNTRACKED],
1313+
link_self_contained: LinkSelfContained = (
1314+
{
1315+
#[cfg(bootstrap)] { LinkSelfContained::default() }
1316+
#[cfg(not(bootstrap))] { LinkSelfContained::with_linker() }
1317+
}, parse_link_self_contained, [UNTRACKED],
13141318
"control whether to link Rust provided C objects/libraries or rely
13151319
on a C toolchain or linker installed in the system"),
13161320
linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
13171321
"system linker to link outputs with"),
1318-
linker_flavor: Option<LinkerFlavorCli> = (None, parse_linker_flavor, [UNTRACKED],
1322+
linker_flavor: Option<LinkerFlavorCli> = (
1323+
{
1324+
#[cfg(bootstrap)] { None }
1325+
#[cfg(not(bootstrap))] {
1326+
use rustc_target::spec::{Cc, Lld};
1327+
Some(LinkerFlavorCli::Gnu(Cc::Yes, Lld::Yes))
1328+
}
1329+
}, parse_linker_flavor, [UNTRACKED],
13191330
"linker flavor"),
13201331
linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled,
13211332
parse_linker_plugin_lto, [TRACKED],

compiler/rustc_target/src/spec/mod.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,7 @@ pub enum LinkerFlavorCli {
184184
impl LinkerFlavorCli {
185185
/// Returns whether this `-C linker-flavor` option is one of the unstable values.
186186
pub fn is_unstable(&self) -> bool {
187-
match self {
188-
LinkerFlavorCli::Gnu(..)
189-
| LinkerFlavorCli::Darwin(..)
190-
| LinkerFlavorCli::WasmLld(..)
191-
| LinkerFlavorCli::Unix(..)
192-
| LinkerFlavorCli::Msvc(Lld::Yes)
193-
| LinkerFlavorCli::EmCc
194-
| LinkerFlavorCli::Bpf
195-
| LinkerFlavorCli::Ptx
196-
| LinkerFlavorCli::BpfLinker
197-
| LinkerFlavorCli::PtxLinker => true,
198-
LinkerFlavorCli::Gcc
199-
| LinkerFlavorCli::Ld
200-
| LinkerFlavorCli::Lld(..)
201-
| LinkerFlavorCli::Msvc(Lld::No)
202-
| LinkerFlavorCli::Em => false,
203-
}
187+
false
204188
}
205189
}
206190

0 commit comments

Comments
 (0)