Skip to content

Commit

Permalink
sync x86_64-unknown-linux-gnu settings file with upstream
Browse files Browse the repository at this point in the history
No need to carry the larger diff since upstream also moved the target to
use lld by default.
  • Loading branch information
tshepang committed May 20, 2024
1 parent ab6a0d9 commit 95d693f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ pub fn target() -> Target {
base.cpu = "x86-64".into();
base.plt_by_default = false;
base.max_atomic_width = Some(64);
// Ferrocene elects to use lld as the linker on this target.
// Upstream still uses ld.
//
// Setting Lld::Yes causes `-fuse-ld=lld` to be added to the linker args
// (and by linker I mean `cc` as the linker as we use Cc::Yes)
base.linker_flavor = LinkerFlavor::Gnu(Cc::Yes, Lld::Yes);
// This setting causes `-B path/to/gcc-ld` to be added to the linker args.
// This means that the `ld.lld` wrapper for `rust-lld` appears in the
// path that `cc` uses to find `ld.lld` (also the path used for `cpp` and
// `cc1`, but we don't supply those so it goes back to the defaults for
// those tools).
base.link_self_contained = crate::spec::LinkSelfContainedDefault::with_linker();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.stack_probes = StackProbeType::Inline;
base.static_position_independent_executables = true;
Expand All @@ -31,6 +19,13 @@ pub fn target() -> Target {
base.supports_xray = true;
base.llvm_args = crate::spec::cvs!["--protect-from-escaped-allocas"];

// 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 {
Expand Down

0 comments on commit 95d693f

Please sign in to comment.