From 793c8e6e3a072c53b11d9b81983e07f163fd8f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Wed, 5 Jul 2023 20:16:26 +0000 Subject: [PATCH] tmp: turn rust-lld on --- compiler/rustc_session/src/config.rs | 9 +++++++-- compiler/rustc_session/src/options.rs | 15 +++++++++++++-- compiler/rustc_target/src/spec/mod.rs | 18 +----------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index f97cb3440d25f..8c90572101dcb 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -308,12 +308,17 @@ impl LinkSelfContained { on } + pub fn with_linker() -> Self { + let mut link_self_contained = LinkSelfContained::default(); + link_self_contained.components.insert(LinkSelfContainedComponents::LINKER); + link_self_contained + } + /// To help checking CLI usage while some of the values are unstable: returns whether one of the /// components was set individually. This would also require the `-Zunstable-options` flag, to /// be allowed. fn are_unstable_variants_set(&self) -> bool { - let any_component_set = !self.components.is_empty(); - self.explicitly_set.is_none() && any_component_set + false } /// Returns whether the self-contained linker component is enabled. diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 7840a0ecf0b96..7dd06aad72a92 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1310,12 +1310,23 @@ options! { #[rustc_lint_opt_deny_field_access("use `Session::link_dead_code` instead of this field")] link_dead_code: Option = (None, parse_opt_bool, [TRACKED], "keep dead code at link time (useful for code coverage) (default: no)"), - link_self_contained: LinkSelfContained = (LinkSelfContained::default(), parse_link_self_contained, [UNTRACKED], + link_self_contained: LinkSelfContained = ( + { + #[cfg(bootstrap)] { LinkSelfContained::default() } + #[cfg(not(bootstrap))] { LinkSelfContained::with_linker() } + }, parse_link_self_contained, [UNTRACKED], "control whether to link Rust provided C objects/libraries or rely on a C toolchain or linker installed in the system"), linker: Option = (None, parse_opt_pathbuf, [UNTRACKED], "system linker to link outputs with"), - linker_flavor: Option = (None, parse_linker_flavor, [UNTRACKED], + linker_flavor: Option = ( + { + #[cfg(bootstrap)] { None } + #[cfg(not(bootstrap))] { + use rustc_target::spec::{Cc, Lld}; + Some(LinkerFlavorCli::Gnu(Cc::Yes, Lld::Yes)) + } + }, parse_linker_flavor, [UNTRACKED], "linker flavor"), linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled, parse_linker_plugin_lto, [TRACKED], diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 2365dfaf1af80..195d82005eaa0 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -184,23 +184,7 @@ pub enum LinkerFlavorCli { impl LinkerFlavorCli { /// Returns whether this `-C linker-flavor` option is one of the unstable values. pub fn is_unstable(&self) -> bool { - match self { - LinkerFlavorCli::Gnu(..) - | LinkerFlavorCli::Darwin(..) - | LinkerFlavorCli::WasmLld(..) - | LinkerFlavorCli::Unix(..) - | LinkerFlavorCli::Msvc(Lld::Yes) - | LinkerFlavorCli::EmCc - | LinkerFlavorCli::Bpf - | LinkerFlavorCli::Ptx - | LinkerFlavorCli::BpfLinker - | LinkerFlavorCli::PtxLinker => true, - LinkerFlavorCli::Gcc - | LinkerFlavorCli::Ld - | LinkerFlavorCli::Lld(..) - | LinkerFlavorCli::Msvc(Lld::No) - | LinkerFlavorCli::Em => false, - } + false } }