380 lines
15 KiB
Diff
380 lines
15 KiB
Diff
From 2b3b4a11dd75ff43e0f1f12de395d0ce29f8555f Mon Sep 17 00:00:00 2001
|
|
From: Daniel Kolesa <daniel@octaforge.org>
|
|
Date: Sat, 3 Jul 2021 21:02:03 +0200
|
|
Subject: [PATCH 15/15] initial ppcle port
|
|
|
|
---
|
|
compiler/rustc_middle/src/ty/layout.rs | 5 ++++-
|
|
compiler/rustc_target/src/spec/mod.rs | 2 ++
|
|
.../src/spec/powerpcle_unknown_linux_gnu.rs | 15 +++++++++++++++
|
|
.../src/spec/powerpcle_unknown_linux_musl.rs | 15 +++++++++++++++
|
|
src/bootstrap/bootstrap.py | 2 ++
|
|
.../codegen/abi-main-signature-16bit-c-int.rs | 1 +
|
|
src/test/codegen/global_asm.rs | 1 +
|
|
src/test/codegen/global_asm_include.rs | 1 +
|
|
src/test/codegen/global_asm_x2.rs | 1 +
|
|
src/test/codegen/repr-transparent-aggregates-1.rs | 1 +
|
|
src/test/codegen/repr-transparent-aggregates-2.rs | 1 +
|
|
src/test/codegen/stack-probes.rs | 1 +
|
|
.../run-make-fulldeps/atomic-lock-free/Makefile | 2 ++
|
|
src/test/ui/abi/stack-probes-lto.rs | 1 +
|
|
src/test/ui/abi/stack-probes.rs | 1 +
|
|
src/test/ui/target-feature/gate.rs | 1 +
|
|
src/test/ui/target-feature/invalid-attribute.rs | 1 +
|
|
src/tools/compiletest/src/util.rs | 1 +
|
|
vendor/cc/src/lib.rs | 1 +
|
|
vendor/target-lexicon/src/targets.rs | 7 +++++++
|
|
vendor/tikv-jemallocator/benches/roundtrip.rs | 3 ++-
|
|
vendor/tikv-jemallocator/src/lib.rs | 3 ++-
|
|
22 files changed, 64 insertions(+), 3 deletions(-)
|
|
create mode 100644 compiler/rustc_target/src/spec/powerpcle_unknown_linux_gnu.rs
|
|
create mode 100644 compiler/rustc_target/src/spec/powerpcle_unknown_linux_musl.rs
|
|
|
|
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
|
|
index 3b05e42a5..66420f507 100644
|
|
--- a/compiler/rustc_middle/src/ty/layout.rs
|
|
+++ b/compiler/rustc_middle/src/ty/layout.rs
|
|
@@ -3205,6 +3205,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
|
target.os == "linux" && target.arch == "sparc64" && target_env_gnu_like;
|
|
let linux_powerpc_gnu_like =
|
|
target.os == "linux" && target.arch == "powerpc" && target_env_gnu_like;
|
|
+ let linux_powerpcle_gnu_like =
|
|
+ target.os == "linux" && target.arch == "powerpcle" && target_env_gnu_like;
|
|
use SpecAbi::*;
|
|
let rust_abi = matches!(sig.abi, RustIntrinsic | PlatformIntrinsic | Rust | RustCall);
|
|
|
|
@@ -3311,7 +3313,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
|
|| (!win_x64_gnu
|
|
&& !linux_s390x_gnu_like
|
|
&& !linux_sparc64_gnu_like
|
|
- && !linux_powerpc_gnu_like)
|
|
+ && !linux_powerpc_gnu_like
|
|
+ && !linux_powerpcle_gnu_like)
|
|
{
|
|
arg.mode = PassMode::Ignore;
|
|
}
|
|
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
|
|
index da0589cdd..2db403913 100644
|
|
--- a/compiler/rustc_target/src/spec/mod.rs
|
|
+++ b/compiler/rustc_target/src/spec/mod.rs
|
|
@@ -831,6 +831,8 @@ supported_targets! {
|
|
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
|
|
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
|
|
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
|
|
+ ("powerpcle-unknown-linux-gnu", powerpcle_unknown_linux_gnu),
|
|
+ ("powerpcle-unknown-linux-musl", powerpcle_unknown_linux_musl),
|
|
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
|
|
("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
|
|
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
|
|
diff --git a/compiler/rustc_target/src/spec/powerpcle_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpcle_unknown_linux_gnu.rs
|
|
new file mode 100644
|
|
index 000000000..b7148a2fc
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/powerpcle_unknown_linux_gnu.rs
|
|
@@ -0,0 +1,15 @@
|
|
+use crate::spec::{LinkerFlavor, Target, TargetOptions};
|
|
+
|
|
+pub fn target() -> Target {
|
|
+ let mut base = super::linux_gnu_base::opts();
|
|
+ base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
|
|
+ base.max_atomic_width = Some(32);
|
|
+
|
|
+ Target {
|
|
+ llvm_target: "powerpcle-unknown-linux-gnu".into(),
|
|
+ pointer_width: 32,
|
|
+ data_layout: "e-m:e-p:32:32-i64:64-n32".into(),
|
|
+ arch: "powerpc".into(),
|
|
+ options: TargetOptions { mcount: "_mcount".into(), ..base },
|
|
+ }
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/powerpcle_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/powerpcle_unknown_linux_musl.rs
|
|
new file mode 100644
|
|
index 000000000..a826b6e47
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/powerpcle_unknown_linux_musl.rs
|
|
@@ -0,0 +1,15 @@
|
|
+use crate::spec::{LinkerFlavor, Target, TargetOptions};
|
|
+
|
|
+pub fn target() -> Target {
|
|
+ let mut base = super::linux_musl_base::opts();
|
|
+ base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".into());
|
|
+ base.max_atomic_width = Some(32);
|
|
+
|
|
+ Target {
|
|
+ llvm_target: "powerpcle-unknown-linux-musl".into(),
|
|
+ pointer_width: 32,
|
|
+ data_layout: "e-m:e-p:32:32-i64:64-n32".into(),
|
|
+ arch: "powerpc".into(),
|
|
+ options: TargetOptions { mcount: "_mcount".into(), ..base },
|
|
+ }
|
|
+}
|
|
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
|
|
index 3501fd901..a28f456d3 100644
|
|
--- a/src/bootstrap/bootstrap.py
|
|
+++ b/src/bootstrap/bootstrap.py
|
|
@@ -339,9 +339,11 @@ def default_build_triple(verbose):
|
|
'i786': 'i686',
|
|
'm68k': 'm68k',
|
|
'powerpc': 'powerpc',
|
|
+ 'powerpcle': 'powerpcle',
|
|
'powerpc64': 'powerpc64',
|
|
'powerpc64le': 'powerpc64le',
|
|
'ppc': 'powerpc',
|
|
+ 'ppcle': 'powerpcle',
|
|
'ppc64': 'powerpc64',
|
|
'ppc64le': 'powerpc64le',
|
|
'riscv64': 'riscv64gc',
|
|
diff --git a/src/test/codegen/abi-main-signature-16bit-c-int.rs b/src/test/codegen/abi-main-signature-16bit-c-int.rs
|
|
index 4ed491dfb..82ec7755d 100644
|
|
--- a/src/test/codegen/abi-main-signature-16bit-c-int.rs
|
|
+++ b/src/test/codegen/abi-main-signature-16bit-c-int.rs
|
|
@@ -9,6 +9,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-powerpc64
|
|
// ignore-riscv64
|
|
// ignore-s390x
|
|
diff --git a/src/test/codegen/global_asm.rs b/src/test/codegen/global_asm.rs
|
|
index fab84868f..104d93d01 100644
|
|
--- a/src/test/codegen/global_asm.rs
|
|
+++ b/src/test/codegen/global_asm.rs
|
|
@@ -12,6 +12,7 @@
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-r600
|
|
// ignore-amdgcn
|
|
// ignore-sparc
|
|
diff --git a/src/test/codegen/global_asm_include.rs b/src/test/codegen/global_asm_include.rs
|
|
index 02ee91645..13f303332 100644
|
|
--- a/src/test/codegen/global_asm_include.rs
|
|
+++ b/src/test/codegen/global_asm_include.rs
|
|
@@ -12,6 +12,7 @@
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-r600
|
|
// ignore-amdgcn
|
|
// ignore-sparc
|
|
diff --git a/src/test/codegen/global_asm_x2.rs b/src/test/codegen/global_asm_x2.rs
|
|
index bdcf0ea84..1e2ff8b8d 100644
|
|
--- a/src/test/codegen/global_asm_x2.rs
|
|
+++ b/src/test/codegen/global_asm_x2.rs
|
|
@@ -12,6 +12,7 @@
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-r600
|
|
// ignore-amdgcn
|
|
// ignore-sparc
|
|
diff --git a/src/test/codegen/repr-transparent-aggregates-1.rs b/src/test/codegen/repr-transparent-aggregates-1.rs
|
|
index 9d18c5f03..8e69d2afd 100644
|
|
--- a/src/test/codegen/repr-transparent-aggregates-1.rs
|
|
+++ b/src/test/codegen/repr-transparent-aggregates-1.rs
|
|
@@ -6,6 +6,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-powerpc64
|
|
// ignore-riscv64 see codegen/riscv-abi
|
|
// ignore-windows
|
|
diff --git a/src/test/codegen/repr-transparent-aggregates-2.rs b/src/test/codegen/repr-transparent-aggregates-2.rs
|
|
index b68e8e9eb..97c509b1b 100644
|
|
--- a/src/test/codegen/repr-transparent-aggregates-2.rs
|
|
+++ b/src/test/codegen/repr-transparent-aggregates-2.rs
|
|
@@ -5,6 +5,7 @@
|
|
// ignore-emscripten
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-riscv64 see codegen/riscv-abi
|
|
diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs
|
|
index 9bd351df3..29073eb56 100644
|
|
--- a/src/test/codegen/stack-probes.rs
|
|
+++ b/src/test/codegen/stack-probes.rs
|
|
@@ -3,6 +3,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-riscv64
|
|
diff --git a/src/test/run-make-fulldeps/atomic-lock-free/Makefile b/src/test/run-make-fulldeps/atomic-lock-free/Makefile
|
|
index 9e8b4fabf..402d37a45 100644
|
|
--- a/src/test/run-make-fulldeps/atomic-lock-free/Makefile
|
|
+++ b/src/test/run-make-fulldeps/atomic-lock-free/Makefile
|
|
@@ -36,6 +36,8 @@ ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc)
|
|
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
|
|
$(RUSTC) --target=powerpc-unknown-linux-gnuspe atomic_lock_free.rs
|
|
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
|
|
+ $(RUSTC) --target=powerpcle-unknown-linux-gnu atomic_lock_free.rs
|
|
+ nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
|
|
$(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs
|
|
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
|
|
$(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs
|
|
diff --git a/src/test/ui/abi/stack-probes-lto.rs b/src/test/ui/abi/stack-probes-lto.rs
|
|
index 90df1f3f5..8c6dda8b8 100644
|
|
--- a/src/test/ui/abi/stack-probes-lto.rs
|
|
+++ b/src/test/ui/abi/stack-probes-lto.rs
|
|
@@ -4,6 +4,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-s390x
|
|
// ignore-sparc
|
|
// ignore-sparc64
|
|
diff --git a/src/test/ui/abi/stack-probes.rs b/src/test/ui/abi/stack-probes.rs
|
|
index e998dd0f8..9472e5387 100644
|
|
--- a/src/test/ui/abi/stack-probes.rs
|
|
+++ b/src/test/ui/abi/stack-probes.rs
|
|
@@ -4,6 +4,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-s390x
|
|
// ignore-sparc
|
|
// ignore-sparc64
|
|
diff --git a/src/test/ui/target-feature/gate.rs b/src/test/ui/target-feature/gate.rs
|
|
index 2382c98f8..e6fe855d7 100644
|
|
--- a/src/test/ui/target-feature/gate.rs
|
|
+++ b/src/test/ui/target-feature/gate.rs
|
|
@@ -5,6 +5,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-riscv64
|
|
diff --git a/src/test/ui/target-feature/invalid-attribute.rs b/src/test/ui/target-feature/invalid-attribute.rs
|
|
index ad1b6e96b..122d59a57 100644
|
|
--- a/src/test/ui/target-feature/invalid-attribute.rs
|
|
+++ b/src/test/ui/target-feature/invalid-attribute.rs
|
|
@@ -5,6 +5,7 @@
|
|
// ignore-mips
|
|
// ignore-mips64
|
|
// ignore-powerpc
|
|
+// ignore-powerpcle
|
|
// ignore-powerpc64
|
|
// ignore-powerpc64le
|
|
// ignore-riscv64
|
|
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
|
|
index 215af347f..a1c7e4c6a 100644
|
|
--- a/src/tools/compiletest/src/util.rs
|
|
+++ b/src/tools/compiletest/src/util.rs
|
|
@@ -71,6 +71,7 @@ const ARCH_TABLE: &[(&str, &str)] = &[
|
|
("msp430", "msp430"),
|
|
("nvptx64", "nvptx64"),
|
|
("powerpc", "powerpc"),
|
|
+ ("powerpcle", "powerpc"),
|
|
("powerpc64", "powerpc64"),
|
|
("powerpc64le", "powerpc64"),
|
|
("riscv64gc", "riscv64"),
|
|
diff --git a/vendor/cc/src/lib.rs b/vendor/cc/src/lib.rs
|
|
index e3a2b98b0..0236729fd 100644
|
|
--- a/vendor/cc/src/lib.rs
|
|
+++ b/vendor/cc/src/lib.rs
|
|
@@ -2594,6 +2594,7 @@ impl Build {
|
|
"powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
|
|
"powerpc-unknown-linux-gnuspe" => Some("powerpc-linux-gnuspe"),
|
|
"powerpc-unknown-netbsd" => Some("powerpc--netbsd"),
|
|
+ "powerpcle-unknown-linux-gnu" => Some("powerpcle-linux-gnu"),
|
|
"powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
|
|
"powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"),
|
|
"riscv32i-unknown-none-elf" => self.find_working_gnu_prefix(&[
|
|
diff --git a/vendor/target-lexicon/src/targets.rs b/vendor/target-lexicon/src/targets.rs
|
|
index 22cc95cc3..46167e34e 100644
|
|
--- a/vendor/target-lexicon/src/targets.rs
|
|
+++ b/vendor/target-lexicon/src/targets.rs
|
|
@@ -29,6 +29,7 @@ pub enum Architecture {
|
|
Msp430,
|
|
Nvptx64,
|
|
Powerpc,
|
|
+ Powerpcle,
|
|
Powerpc64,
|
|
Powerpc64le,
|
|
Riscv32(Riscv32Architecture),
|
|
@@ -533,6 +534,7 @@ impl Architecture {
|
|
| Mips64(Mips64Architecture::Mipsisa64r6el)
|
|
| Msp430
|
|
| Nvptx64
|
|
+ | Powerpcle
|
|
| Powerpc64le
|
|
| Riscv32(_)
|
|
| Riscv64(_)
|
|
@@ -574,6 +576,7 @@ impl Architecture {
|
|
| M68k
|
|
| Mips32(_)
|
|
| Powerpc
|
|
+ | Powerpcle
|
|
| XTensa => Ok(PointerWidth::U32),
|
|
AmdGcn
|
|
| Bpfeb
|
|
@@ -763,6 +766,7 @@ impl fmt::Display for Architecture {
|
|
Msp430 => f.write_str("msp430"),
|
|
Nvptx64 => f.write_str("nvptx64"),
|
|
Powerpc => f.write_str("powerpc"),
|
|
+ Powerpcle => f.write_str("powerpcle"),
|
|
Powerpc64 => f.write_str("powerpc64"),
|
|
Powerpc64le => f.write_str("powerpc64le"),
|
|
Riscv32(riscv32) => riscv32.fmt(f),
|
|
@@ -943,6 +947,7 @@ impl FromStr for Architecture {
|
|
"msp430" => Msp430,
|
|
"nvptx64" => Nvptx64,
|
|
"powerpc" => Powerpc,
|
|
+ "powerpcle" => Powerpcle,
|
|
"powerpc64" => Powerpc64,
|
|
"powerpc64le" => Powerpc64le,
|
|
"s390x" => S390x,
|
|
@@ -1445,6 +1450,8 @@ mod tests {
|
|
"powerpc-unknown-openbsd",
|
|
"powerpc-wrs-vxworks",
|
|
"powerpc-wrs-vxworks-spe",
|
|
+ "powerpcle-unknown-linux-gnu",
|
|
+ "powerpcle-unknown-linux-musl",
|
|
"powerpc64-unknown-freebsd",
|
|
"powerpc64-unknown-linux-gnu",
|
|
"powerpc64-unknown-linux-musl",
|
|
diff --git a/vendor/tikv-jemallocator/benches/roundtrip.rs b/vendor/tikv-jemallocator/benches/roundtrip.rs
|
|
index 767abe8d4..704bf955a 100644
|
|
--- a/vendor/tikv-jemallocator/benches/roundtrip.rs
|
|
+++ b/vendor/tikv-jemallocator/benches/roundtrip.rs
|
|
@@ -22,7 +22,8 @@ static A: Jemalloc = Jemalloc;
|
|
target_arch = "arm",
|
|
target_arch = "mips",
|
|
target_arch = "mipsel",
|
|
- target_arch = "powerpc"
|
|
+ target_arch = "powerpc",
|
|
+ target_arch = "powerpcle",
|
|
)))]
|
|
const MIN_ALIGN: usize = 8;
|
|
#[cfg(all(any(
|
|
diff --git a/vendor/tikv-jemallocator/src/lib.rs b/vendor/tikv-jemallocator/src/lib.rs
|
|
index 4a9397331..4cf47c05d 100644
|
|
--- a/vendor/tikv-jemallocator/src/lib.rs
|
|
+++ b/vendor/tikv-jemallocator/src/lib.rs
|
|
@@ -46,7 +46,8 @@ use libc::{c_int, c_void};
|
|
target_arch = "arm",
|
|
target_arch = "mips",
|
|
target_arch = "mipsel",
|
|
- target_arch = "powerpc"
|
|
+ target_arch = "powerpc",
|
|
+ target_arch = "powerpcle",
|
|
)))]
|
|
const ALIGNOF_MAX_ALIGN_T: usize = 8;
|
|
#[cfg(all(any(
|
|
--
|
|
2.37.2
|
|
|