rvc/rust-target-rv32ima.patch
2021-08-17 10:26:30 +02:00

228 lines
12 KiB
Diff

From e23b4e558bd1d6bcdc63751a66af6657b21da4f5 Mon Sep 17 00:00:00 2001
From: Stefan <stefan@pimaker.at>
Date: Wed, 9 Jun 2021 15:18:26 +0200
Subject: [PATCH] rust target rv32ima
Signed-off-by: Stefan <stefan@pimaker.at>
---
compiler/rustc_target/src/spec/mod.rs | 1 +
.../src/spec/riscv32ima_unknown_none_elf.rs | 26 ++++
src/doc/rustc/src/platform-support.md | 143 ++++++++++--------
src/tools/build-manifest/src/main.rs | 1 +
4 files changed, 107 insertions(+), 64 deletions(-)
create mode 100644 compiler/rustc_target/src/spec/riscv32ima_unknown_none_elf.rs
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 0f2aaeb533a..81417fd5647 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -868,6 +868,7 @@ fn $module() {
("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf),
("riscv32imc-unknown-none-elf", riscv32imc_unknown_none_elf),
("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),
+ ("riscv32ima-unknown-none-elf", riscv32ima_unknown_none_elf),
("riscv32gc-unknown-linux-gnu", riscv32gc_unknown_linux_gnu),
("riscv32gc-unknown-linux-musl", riscv32gc_unknown_linux_musl),
("riscv64imac-unknown-none-elf", riscv64imac_unknown_none_elf),
diff --git a/compiler/rustc_target/src/spec/riscv32ima_unknown_none_elf.rs b/compiler/rustc_target/src/spec/riscv32ima_unknown_none_elf.rs
new file mode 100644
index 00000000000..6f0ef862582
--- /dev/null
+++ b/compiler/rustc_target/src/spec/riscv32ima_unknown_none_elf.rs
@@ -0,0 +1,26 @@
+use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel};
+use crate::spec::{Target, TargetOptions};
+
+pub fn target() -> Target {
+ Target {
+ data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(),
+ llvm_target: "riscv32".to_string(),
+ pointer_width: 32,
+ arch: "riscv32".to_string(),
+
+ options: TargetOptions {
+ linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
+ linker: Some("rust-lld".to_string()),
+ cpu: "generic-rv32".to_string(),
+ max_atomic_width: Some(32),
+ features: "+m,+a".to_string(),
+ executables: true,
+ panic_strategy: PanicStrategy::Abort,
+ relocation_model: RelocModel::Static,
+ emit_debug_gdb_scripts: false,
+ unsupported_abis: super::riscv_base::unsupported_abis(),
+ eh_frame_header: false,
+ ..Default::default()
+ },
+ }
+}
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index 3225e95941c..7a58992293a 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -107,70 +107,85 @@ policy](target-tier-policy.md#tier-2-target-policy) in the Target Tier Policy.
The `std` column in the table below has the following meanings:
-* ✓ indicates the full standard library is available.
-* \* indicates the target only supports [`no_std`] development.
-
-[`no_std`]: https://rust-embedded.github.io/book/intro/no-std.html
-
-target | std | notes
--------|:---:|-------
-`aarch64-apple-ios` | ✓ | ARM64 iOS
-`aarch64-fuchsia` | ✓ | ARM64 Fuchsia
-`aarch64-linux-android` | ✓ | ARM64 Android
-`aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat
-`aarch64-unknown-none` | * | Bare ARM64, hardfloat
-`arm-linux-androideabi` | ✓ | ARMv7 Android
-`arm-unknown-linux-musleabi` | ✓ | ARMv6 Linux with MUSL
-`arm-unknown-linux-musleabihf` | ✓ | ARMv6 Linux with MUSL, hardfloat
-`armebv7r-none-eabi` | * | Bare ARMv7-R, Big Endian
-`armebv7r-none-eabihf` | * | Bare ARMv7-R, Big Endian, hardfloat
-`armv5te-unknown-linux-gnueabi` | ✓ | ARMv5TE Linux (kernel 4.4, glibc 2.23)
-`armv5te-unknown-linux-musleabi` | ✓ | ARMv5TE Linux with MUSL
-`armv7-linux-androideabi` | ✓ | ARMv7a Android
-`armv7-unknown-linux-gnueabi` | ✓ |ARMv7 Linux (kernel 4.15, glibc 2.27)
-`armv7-unknown-linux-musleabi` | ✓ |ARMv7 Linux, MUSL
-`armv7-unknown-linux-musleabihf` | ✓ | ARMv7 Linux with MUSL
-`armv7a-none-eabi` | * | Bare ARMv7-A
-`armv7r-none-eabi` | * | Bare ARMv7-R
-`armv7r-none-eabihf` | * | Bare ARMv7-R, hardfloat
-`asmjs-unknown-emscripten` | ✓ | asm.js via Emscripten
-`i586-pc-windows-msvc` | ✓ | 32-bit Windows w/o SSE
-`i586-unknown-linux-gnu` | ✓ | 32-bit Linux w/o SSE (kernel 4.4, glibc 2.23)
-`i586-unknown-linux-musl` | ✓ | 32-bit Linux w/o SSE, MUSL
-`i686-linux-android` | ✓ | 32-bit x86 Android
-`i686-unknown-freebsd` | ✓ | 32-bit FreeBSD
-`i686-unknown-linux-musl` | ✓ | 32-bit Linux with MUSL
-`mips-unknown-linux-musl` | ✓ | MIPS Linux with MUSL
-`mips64-unknown-linux-muslabi64` | ✓ | MIPS64 Linux, n64 ABI, MUSL
-`mips64el-unknown-linux-muslabi64` | ✓ | MIPS64 (LE) Linux, n64 ABI, MUSL
-`mipsel-unknown-linux-musl` | ✓ | MIPS (LE) Linux with MUSL
-`nvptx64-nvidia-cuda` | * | --emit=asm generates PTX code that [runs on NVIDIA GPUs]
-`riscv32i-unknown-none-elf` | * | Bare RISC-V (RV32I ISA)
-`riscv32imac-unknown-none-elf` | * | Bare RISC-V (RV32IMAC ISA)
-`riscv32imc-unknown-none-elf` | * | Bare RISC-V (RV32IMC ISA)
-`riscv64gc-unknown-none-elf` | * | Bare RISC-V (RV64IMAFDC ISA)
-`riscv64imac-unknown-none-elf` | * | Bare RISC-V (RV64IMAC ISA)
-`sparc64-unknown-linux-gnu` | ✓ | SPARC Linux (kernel 4.4, glibc 2.23)
-`sparcv9-sun-solaris` | ✓ | SPARC Solaris 10/11, illumos
-`thumbv6m-none-eabi` | * | Bare Cortex-M0, M0+, M1
-`thumbv7em-none-eabi` | * | Bare Cortex-M4, M7
-`thumbv7em-none-eabihf` | * | Bare Cortex-M4F, M7F, FPU, hardfloat
-`thumbv7m-none-eabi` | * | Bare Cortex-M3
-`thumbv7neon-linux-androideabi` | ✓ | Thumb2-mode ARMv7a Android with NEON
-`thumbv7neon-unknown-linux-gnueabihf` | ✓ | Thumb2-mode ARMv7a Linux with NEON (kernel 4.4, glibc 2.23)
-`thumbv8m.base-none-eabi` | * | ARMv8-M Baseline
-`thumbv8m.main-none-eabi` | * | ARMv8-M Mainline
-`thumbv8m.main-none-eabihf` | * | ARMv8-M Mainline, hardfloat
-`wasm32-unknown-emscripten` | ✓ | WebAssembly via Emscripten
-`wasm32-unknown-unknown` | ✓ | WebAssembly
-`wasm32-wasi` | ✓ | WebAssembly with WASI
-`x86_64-apple-ios` | ✓ | 64-bit x86 iOS
-`x86_64-fortanix-unknown-sgx` | ✓ | [Fortanix ABI] for 64-bit Intel SGX
-`x86_64-fuchsia` | ✓ | 64-bit Fuchsia
-`x86_64-linux-android` | ✓ | 64-bit x86 Android
-`x86_64-pc-solaris` | ✓ | 64-bit Solaris 10/11, illumos
-`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
-`x86_64-unknown-redox` | ✓ | Redox OS
+target | std | host | notes
+-------|-----|------|-------
+`aarch64-apple-darwin` | ✓ | ✓ | ARM64 macOS (11.0+, Big Sur+)
+`aarch64-apple-ios` | ✓ | | ARM64 iOS
+`aarch64-fuchsia` | ✓ | | ARM64 Fuchsia
+`aarch64-linux-android` | ✓ | | ARM64 Android
+`aarch64-pc-windows-msvc` | ✓ | ✓ | ARM64 Windows MSVC
+`aarch64-unknown-linux-musl` | ✓ | ✓ | ARM64 Linux with MUSL
+`aarch64-unknown-none` | * | | Bare ARM64, hardfloat
+`aarch64-unknown-none-softfloat` | * | | Bare ARM64, softfloat
+`arm-linux-androideabi` | ✓ | | ARMv7 Android
+`arm-unknown-linux-gnueabi` | ✓ | ✓ | ARMv6 Linux (kernel 3.2, glibc 2.17)
+`arm-unknown-linux-gnueabihf` | ✓ | ✓ | ARMv6 Linux, hardfloat (kernel 3.2, glibc 2.17)
+`arm-unknown-linux-musleabi` | ✓ | | ARMv6 Linux with MUSL
+`arm-unknown-linux-musleabihf` | ✓ | | ARMv6 Linux with MUSL, hardfloat
+`armebv7r-none-eabi` | * | | Bare ARMv7-R, Big Endian
+`armebv7r-none-eabihf` | * | | Bare ARMv7-R, Big Endian, hardfloat
+`armv5te-unknown-linux-gnueabi` | ✓ | | ARMv5TE Linux (kernel 4.4, glibc 2.23)
+`armv5te-unknown-linux-musleabi` | ✓ | | ARMv5TE Linux with MUSL
+`armv7-linux-androideabi` | ✓ | | ARMv7a Android
+`armv7a-none-eabi` | * | | Bare ARMv7-A
+`armv7r-none-eabi` | * | | Bare ARMv7-R
+`armv7r-none-eabihf` | * | | Bare ARMv7-R, hardfloat
+`armv7-unknown-linux-gnueabi` | ✓ | | ARMv7 Linux (kernel 4.15, glibc 2.27)
+`armv7-unknown-linux-gnueabihf` | ✓ | ✓ | ARMv7 Linux, hardfloat (kernel 3.2, glibc 2.17)
+`armv7-unknown-linux-musleabi` | ✓ | | ARMv7 Linux, MUSL
+`armv7-unknown-linux-musleabihf` | ✓ | | ARMv7 Linux with MUSL
+`asmjs-unknown-emscripten` | ✓ | | asm.js via Emscripten
+`i586-pc-windows-msvc` | ✓ | | 32-bit Windows w/o SSE
+`i586-unknown-linux-gnu` | ✓ | | 32-bit Linux w/o SSE (kernel 4.4, glibc 2.23)
+`i586-unknown-linux-musl` | ✓ | | 32-bit Linux w/o SSE, MUSL
+`i686-linux-android` | ✓ | | 32-bit x86 Android
+`i686-unknown-freebsd` | ✓ | | 32-bit FreeBSD
+`i686-unknown-linux-musl` | ✓ | | 32-bit Linux with MUSL
+`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
+`mips-unknown-linux-musl` | ✓ | | MIPS Linux with MUSL
+`mips64-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 Linux, n64 ABI (kernel 4.4, glibc 2.23)
+`mips64-unknown-linux-muslabi64` | ✓ | | MIPS64 Linux, n64 ABI, MUSL
+`mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | MIPS64 (LE) Linux, n64 ABI (kernel 4.4, glibc 2.23)
+`mips64el-unknown-linux-muslabi64` | ✓ | | MIPS64 (LE) Linux, n64 ABI, MUSL
+`mipsel-unknown-linux-gnu` | ✓ | ✓ | MIPS (LE) Linux (kernel 4.4, glibc 2.23)
+`mipsel-unknown-linux-musl` | ✓ | | MIPS (LE) Linux with MUSL
+`nvptx64-nvidia-cuda` | ✓ | | --emit=asm generates PTX code that [runs on NVIDIA GPUs]
+`powerpc-unknown-linux-gnu` | ✓ | ✓ | PowerPC Linux (kernel 2.6.32, glibc 2.11)
+`powerpc64-unknown-linux-gnu` | ✓ | ✓ | PPC64 Linux (kernel 2.6.32, glibc 2.11)
+`powerpc64le-unknown-linux-gnu` | ✓ | ✓ | PPC64LE Linux (kernel 3.10, glibc 2.17)
+`riscv32i-unknown-none-elf` | * | | Bare RISC-V (RV32I ISA)
+`riscv32imac-unknown-none-elf` | * | | Bare RISC-V (RV32IMAC ISA)
+`riscv32ima-unknown-none-elf` | * | | Bare RISC-V (RV32IMA ISA)
+`riscv32imc-unknown-none-elf` | * | | Bare RISC-V (RV32IMC ISA)
+`riscv64gc-unknown-linux-gnu` | ✓ | ✓ | RISC-V Linux (kernel 4.20, glibc 2.29)
+`riscv64gc-unknown-none-elf` | * | | Bare RISC-V (RV64IMAFDC ISA)
+`riscv64imac-unknown-none-elf` | * | | Bare RISC-V (RV64IMAC ISA)
+`s390x-unknown-linux-gnu` | ✓ | ✓ | S390x Linux (kernel 2.6.32, glibc 2.11)
+`sparc64-unknown-linux-gnu` | ✓ | | SPARC Linux (kernel 4.4, glibc 2.23)
+`sparcv9-sun-solaris` | ✓ | | SPARC Solaris 10/11, illumos
+`thumbv6m-none-eabi` | * | | Bare Cortex-M0, M0+, M1
+`thumbv7em-none-eabi` | * | | Bare Cortex-M4, M7
+`thumbv7em-none-eabihf` | * | | Bare Cortex-M4F, M7F, FPU, hardfloat
+`thumbv7m-none-eabi` | * | | Bare Cortex-M3
+`thumbv7neon-linux-androideabi` | ✓ | | Thumb2-mode ARMv7a Android with NEON
+`thumbv7neon-unknown-linux-gnueabihf` | ✓ | | Thumb2-mode ARMv7a Linux with NEON (kernel 4.4, glibc 2.23)
+`thumbv8m.base-none-eabi` | * | | ARMv8-M Baseline
+`thumbv8m.main-none-eabi` | * | | ARMv8-M Mainline
+`thumbv8m.main-none-eabihf` | * | | ARMv8-M Mainline, hardfloat
+`wasm32-unknown-emscripten` | ✓ | | WebAssembly via Emscripten
+`wasm32-unknown-unknown` | ✓ | | WebAssembly
+`wasm32-wasi` | ✓ | | WebAssembly with WASI
+`x86_64-apple-ios` | ✓ | | 64-bit x86 iOS
+`x86_64-fortanix-unknown-sgx` | ✓ | | [Fortanix ABI] for 64-bit Intel SGX
+`x86_64-fuchsia` | ✓ | | 64-bit Fuchsia
+`x86_64-linux-android` | ✓ | | 64-bit x86 Android
+`x86_64-pc-solaris` | ✓ | | 64-bit Solaris 10/11, illumos
+`x86_64-unknown-freebsd` | ✓ | ✓ | 64-bit FreeBSD
+`x86_64-unknown-illumos` | ✓ | ✓ | illumos
+`x86_64-unknown-linux-gnux32` | ✓ | | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
+`x86_64-unknown-linux-musl` | ✓ | ✓ | 64-bit Linux with MUSL
+`x86_64-unknown-netbsd` | ✓ | ✓ | NetBSD/amd64
+`x86_64-unknown-redox` | ✓ | | Redox OS
[Fortanix ABI]: https://edp.fortanix.com/
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
index 1e19b7b21d8..a411320ac9e 100644
--- a/src/tools/build-manifest/src/main.rs
+++ b/src/tools/build-manifest/src/main.rs
@@ -116,6 +116,7 @@
"powerpc64le-unknown-linux-gnu",
"riscv32i-unknown-none-elf",
"riscv32imc-unknown-none-elf",
+ "riscv32ima-unknown-none-elf",
"riscv32imac-unknown-none-elf",
"riscv32gc-unknown-linux-gnu",
"riscv64imac-unknown-none-elf",
--
2.32.0