From 24152ec296187b7ac10d02488600779327c6a327 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Sat, 27 Mar 2021 17:02:06 +0100 Subject: [PATCH 1/4] Add support for powerpc64le-unknown-freebsd. --- compiler/rustc_target/src/spec/mod.rs | 1 + .../src/spec/powerpc64le_unknown_freebsd.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index ddfd82625221f..404eb0b5267f4 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -686,6 +686,7 @@ supported_targets! { ("armv7-unknown-freebsd", armv7_unknown_freebsd), ("i686-unknown-freebsd", i686_unknown_freebsd), ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), + ("powerpc64le-unknown-freebsd", powerpc64le_unknown_freebsd), ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), ("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly), diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs new file mode 100644 index 0000000000000..859640e3ed2f6 --- /dev/null +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs @@ -0,0 +1,16 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions}; + +pub fn target() -> Target { + let mut base = super::freebsd_base::opts(); + base.cpu = "ppc64le".to_string(); + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); + base.max_atomic_width = Some(64); + + Target { + llvm_target: "powerpc64le-unknown-freebsd".to_string(), + pointer_width: 64, + data_layout: "e-m:e-i64:64-n32:64".to_string(), + arch: "powerpc64".to_string(), + options: TargetOptions { mcount: "_mcount".to_string(), ..base }, + } +} From f8ad6019b6f14926e209948e1e03fa7c25430606 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Wed, 14 Apr 2021 01:37:08 +0200 Subject: [PATCH 2/4] Add powerpc64le-unknown-freebsd to src/doc/rustc/src/platform-support.md --- src/doc/rustc/src/platform-support.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index ee17fcac45c36..0f087b8f1a661 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -202,6 +202,7 @@ target | std | host | notes `powerpc-wrs-vxworks` | ? | | `powerpc-wrs-vxworks-spe` | ? | | `powerpc64-unknown-freebsd` | ✓ | ✓ | PPC64 FreeBSD (ELFv1 and ELFv2) +`powerpc64le-unknown-freebsd` | | | PPC64LE FreeBSD `powerpc64-unknown-linux-musl` | ? | | `powerpc64-wrs-vxworks` | ? | | `powerpc64le-unknown-linux-musl` | ? | | From 43a2b1abf13d48a589744f0b8c417aa6076a5702 Mon Sep 17 00:00:00 2001 From: pkubaj Date: Wed, 14 Apr 2021 00:15:38 +0000 Subject: [PATCH 3/4] Switch powerpc64le-unknown-freebsd to or_default() --- compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs index 859640e3ed2f6..2ed669f159d74 100644 --- a/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions}; pub fn target() -> Target { let mut base = super::freebsd_base::opts(); base.cpu = "ppc64le".to_string(); - base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).or_default().push("-m64".to_string()); base.max_atomic_width = Some(64); Target { From a2f532de215bec6158a4f72f1070dd4eec7fea47 Mon Sep 17 00:00:00 2001 From: pkubaj Date: Wed, 14 Apr 2021 08:54:11 +0000 Subject: [PATCH 4/4] Replace get_mut(& with entry( for powerpc64le-unknown-freebsd --- compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs index 2ed669f159d74..283e9f744cbfc 100644 --- a/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs @@ -3,7 +3,7 @@ use crate::spec::{LinkerFlavor, Target, TargetOptions}; pub fn target() -> Target { let mut base = super::freebsd_base::opts(); base.cpu = "ppc64le".to_string(); - base.pre_link_args.get_mut(&LinkerFlavor::Gcc).or_default().push("-m64".to_string()); + base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m64".to_string()); base.max_atomic_width = Some(64); Target {