Skip to content

Commit

Permalink
tmp: turn rust-lld on
Browse files Browse the repository at this point in the history
  • Loading branch information
lqd committed Jul 5, 2023
1 parent 5dac6b3 commit 793c8e6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
9 changes: 7 additions & 2 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 13 additions & 2 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,12 +1310,23 @@ options! {
#[rustc_lint_opt_deny_field_access("use `Session::link_dead_code` instead of this field")]
link_dead_code: Option<bool> = (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<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
"system linker to link outputs with"),
linker_flavor: Option<LinkerFlavorCli> = (None, parse_linker_flavor, [UNTRACKED],
linker_flavor: Option<LinkerFlavorCli> = (
{
#[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],
Expand Down
18 changes: 1 addition & 17 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 793c8e6

Please sign in to comment.