enable rust-lld on x86_64-unknown-linux-gnu
when requested
the `rust.lld` config enables rustc's `CFG_USE_SELF_CONTAINED_LINKER` env var, and we: - set the linker-flavor to use lld - enable the self-contained linker this makes the target use the rust-lld linker by default
This commit is contained in:
parent
5f04f6d7e1
commit
7695e5aeb4
2 changed files with 13 additions and 0 deletions
|
@ -612,6 +612,12 @@ impl LinkSelfContainedDefault {
|
|||
_ => "crt-objects-fallback",
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a `LinkSelfContainedDefault` enabling the self-contained linker for target specs
|
||||
/// (the equivalent of `-Clink-self-contained=+linker` on the CLI).
|
||||
pub fn with_linker() -> LinkSelfContainedDefault {
|
||||
LinkSelfContainedDefault::WithComponents(LinkSelfContainedComponents::LINKER)
|
||||
}
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
|
|
|
@ -18,6 +18,13 @@ pub fn target() -> Target {
|
|||
| SanitizerSet::THREAD;
|
||||
base.supports_xray = true;
|
||||
|
||||
// When we're asked to use the `rust-lld` linker by default, set the appropriate lld-using
|
||||
// linker flavor, and self-contained linker component.
|
||||
if option_env!("CFG_USE_SELF_CONTAINED_LINKER").is_some() {
|
||||
base.linker_flavor = LinkerFlavor::Gnu(Cc::Yes, Lld::Yes);
|
||||
base.link_self_contained = crate::spec::LinkSelfContainedDefault::with_linker();
|
||||
}
|
||||
|
||||
Target {
|
||||
llvm_target: "x86_64-unknown-linux-gnu".into(),
|
||||
metadata: crate::spec::TargetMetadata {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue