Skip to content

Commit 567009f

Browse files
committed
tmp: turn rust-lld on
1 parent e5fedce commit 567009f

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
@@ -310,12 +310,17 @@ impl LinkSelfContained {
310310
on
311311
}
312312

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

321326
/// 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
@@ -1324,12 +1324,23 @@ options! {
13241324
#[rustc_lint_opt_deny_field_access("use `Session::link_dead_code` instead of this field")]
13251325
link_dead_code: Option<bool> = (None, parse_opt_bool, [TRACKED],
13261326
"keep dead code at link time (useful for code coverage) (default: no)"),
1327-
link_self_contained: LinkSelfContained = (LinkSelfContained::default(), parse_link_self_contained, [UNTRACKED],
1327+
link_self_contained: LinkSelfContained = (
1328+
{
1329+
#[cfg(bootstrap)] { LinkSelfContained::default() }
1330+
#[cfg(not(bootstrap))] { LinkSelfContained::with_linker() }
1331+
}, parse_link_self_contained, [UNTRACKED],
13281332
"control whether to link Rust provided C objects/libraries or rely
13291333
on a C toolchain or linker installed in the system"),
13301334
linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
13311335
"system linker to link outputs with"),
1332-
linker_flavor: Option<LinkerFlavorCli> = (None, parse_linker_flavor, [UNTRACKED],
1336+
linker_flavor: Option<LinkerFlavorCli> = (
1337+
{
1338+
#[cfg(bootstrap)] { None }
1339+
#[cfg(not(bootstrap))] {
1340+
use rustc_target::spec::{Cc, Lld};
1341+
Some(LinkerFlavorCli::Gnu(Cc::Yes, Lld::Yes))
1342+
}
1343+
}, parse_linker_flavor, [UNTRACKED],
13331344
"linker flavor"),
13341345
linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled,
13351346
parse_linker_plugin_lto, [TRACKED],

compiler/rustc_target/src/spec/mod.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,7 @@ pub enum LinkerFlavorCli {
189189
impl LinkerFlavorCli {
190190
/// Returns whether this `-C linker-flavor` option is one of the unstable values.
191191
pub fn is_unstable(&self) -> bool {
192-
match self {
193-
LinkerFlavorCli::Gnu(..)
194-
| LinkerFlavorCli::Darwin(..)
195-
| LinkerFlavorCli::WasmLld(..)
196-
| LinkerFlavorCli::Unix(..)
197-
| LinkerFlavorCli::Msvc(Lld::Yes)
198-
| LinkerFlavorCli::EmCc
199-
| LinkerFlavorCli::Bpf
200-
| LinkerFlavorCli::Ptx
201-
| LinkerFlavorCli::BpfLinker
202-
| LinkerFlavorCli::PtxLinker => true,
203-
LinkerFlavorCli::Gcc
204-
| LinkerFlavorCli::Ld
205-
| LinkerFlavorCli::Lld(..)
206-
| LinkerFlavorCli::Msvc(Lld::No)
207-
| LinkerFlavorCli::Em => false,
208-
}
192+
false
209193
}
210194
}
211195

0 commit comments

Comments
 (0)