Skip to content

Commit a338091

Browse files
committed
Add Thumb-mode targets for Armv7-R, Armv7-A and Armv8-R.
1 parent 52cb2ba commit a338091

File tree

12 files changed

+188
-13
lines changed

12 files changed

+188
-13
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,8 +1596,11 @@ supported_targets! {
15961596
("armebv7r-none-eabi", armebv7r_none_eabi),
15971597
("armebv7r-none-eabihf", armebv7r_none_eabihf),
15981598
("armv7r-none-eabi", armv7r_none_eabi),
1599+
("thumbv7r-none-eabi", thumbv7r_none_eabi),
15991600
("armv7r-none-eabihf", armv7r_none_eabihf),
1601+
("thumbv7r-none-eabihf", thumbv7r_none_eabihf),
16001602
("armv8r-none-eabihf", armv8r_none_eabihf),
1603+
("thumbv8r-none-eabihf", thumbv8r_none_eabihf),
16011604

16021605
("armv7-rtems-eabihf", armv7_rtems_eabihf),
16031606

@@ -1649,7 +1652,9 @@ supported_targets! {
16491652
("thumbv8m.main-none-eabihf", thumbv8m_main_none_eabihf),
16501653

16511654
("armv7a-none-eabi", armv7a_none_eabi),
1655+
("thumbv7a-none-eabi", thumbv7a_none_eabi),
16521656
("armv7a-none-eabihf", armv7a_none_eabihf),
1657+
("thumbv7a-none-eabihf", thumbv7a_none_eabihf),
16531658
("armv7a-nuttx-eabi", armv7a_nuttx_eabi),
16541659
("armv7a-nuttx-eabihf", armv7a_nuttx_eabihf),
16551660
("armv7a-vex-v5", armv7a_vex_v5),
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
2+
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "thumbv7a-none-eabi".into(),
8+
metadata: TargetMetadata {
9+
description: Some("Thumb-mode Bare Armv7-A".into()),
10+
tier: Some(2),
11+
host_tools: Some(false),
12+
std: Some(false),
13+
},
14+
pointer_width: 32,
15+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16+
arch: Arch::Arm,
17+
options: TargetOptions {
18+
abi: Abi::Eabi,
19+
llvm_floatabi: Some(FloatAbi::Soft),
20+
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
21+
max_atomic_width: Some(64),
22+
has_thumb_interworking: true,
23+
..base::arm_none::opts()
24+
},
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
2+
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "thumbv7a-none-eabihf".into(),
8+
metadata: TargetMetadata {
9+
description: Some("Thumb-mode Bare Armv7-A, hardfloat".into()),
10+
tier: Some(2),
11+
host_tools: Some(false),
12+
std: Some(false),
13+
},
14+
pointer_width: 32,
15+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16+
arch: Arch::Arm,
17+
options: TargetOptions {
18+
abi: Abi::EabiHf,
19+
llvm_floatabi: Some(FloatAbi::Hard),
20+
features: "+v7,+vfp3d16,+thumb2,-neon,+strict-align".into(),
21+
max_atomic_width: Some(64),
22+
has_thumb_interworking: true,
23+
..base::arm_none::opts()
24+
},
25+
}
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
2+
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "thumbv7r-none-eabi".into(),
8+
metadata: TargetMetadata {
9+
description: Some("Thumb-mode Bare Armv7-R".into()),
10+
tier: Some(2),
11+
host_tools: Some(false),
12+
std: Some(false),
13+
},
14+
pointer_width: 32,
15+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16+
arch: Arch::Arm,
17+
options: TargetOptions {
18+
abi: Abi::Eabi,
19+
llvm_floatabi: Some(FloatAbi::Soft),
20+
max_atomic_width: Some(64),
21+
has_thumb_interworking: true,
22+
..base::arm_none::opts()
23+
},
24+
}
25+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
2+
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "thumbv7r-none-eabihf".into(),
8+
metadata: TargetMetadata {
9+
description: Some("Thumb-mode Bare Armv7-R, hardfloat".into()),
10+
tier: Some(2),
11+
host_tools: Some(false),
12+
std: Some(false),
13+
},
14+
pointer_width: 32,
15+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16+
arch: Arch::Arm,
17+
options: TargetOptions {
18+
abi: Abi::EabiHf,
19+
llvm_floatabi: Some(FloatAbi::Hard),
20+
features: "+vfp3d16".into(),
21+
max_atomic_width: Some(64),
22+
has_thumb_interworking: true,
23+
..base::arm_none::opts()
24+
},
25+
}
26+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
2+
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4+
5+
pub(crate) fn target() -> Target {
6+
Target {
7+
llvm_target: "thumbv8r-none-eabihf".into(),
8+
metadata: TargetMetadata {
9+
description: Some("Thumb-mode Bare Armv8-R, hardfloat".into()),
10+
tier: Some(2),
11+
host_tools: Some(false),
12+
std: Some(false),
13+
},
14+
pointer_width: 32,
15+
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16+
arch: Arch::Arm,
17+
18+
options: TargetOptions {
19+
abi: Abi::EabiHf,
20+
llvm_floatabi: Some(FloatAbi::Hard),
21+
// Armv8-R requires a minimum set of floating-point features equivalent to:
22+
// fp-armv8, SP-only, with 16 DP (32 SP) registers
23+
// LLVM defines Armv8-R to include these features automatically.
24+
//
25+
// The Cortex-R52 supports these default features and optionally includes:
26+
// neon-fp-armv8, SP+DP, with 32 DP registers
27+
//
28+
// Reference:
29+
// Arm Cortex-R52 Processor Technical Reference Manual
30+
// - Chapter 15 Advanced SIMD and floating-point support
31+
max_atomic_width: Some(64),
32+
has_thumb_interworking: true,
33+
..base::arm_none::opts()
34+
},
35+
}
36+
}

src/bootstrap/src/core/sanity.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ pub struct Finder {
3838
const STAGE0_MISSING_TARGETS: &[&str] = &[
3939
// just a dummy comment so the list doesn't get onelined
4040
"riscv64im-unknown-none-elf",
41+
"thumbv7a-none-eabi",
42+
"thumbv7a-none-eabihf",
43+
"thumbv7r-none-eabi",
44+
"thumbv7r-none-eabihf",
45+
"thumbv8r-none-eabihf",
4146
];
4247

4348
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM

src/doc/rustc/src/platform-support.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,17 +410,22 @@ target | std | host | notes
410410
[`thumbv4t-none-eabi`](platform-support/armv4t-none-eabi.md) | * | | Thumb-mode Bare Armv4T
411411
[`thumbv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | Thumb-mode Bare Armv5TE
412412
[`thumbv6m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv6M with NuttX
413-
`thumbv7a-pc-windows-msvc` | | |
414-
[`thumbv7a-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | | |
413+
[`thumbv7a-none-eabi`](platform-support/armv7a-none-eabi.md) | * | | Thumb-mode Bare Armv7-A
414+
[`thumbv7a-none-eabihf`](platform-support/armv7a-none-eabi.md) | * | | Thumb-mode Bare Armv7-A, hardfloat
415415
[`thumbv7a-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7-A with NuttX
416416
[`thumbv7a-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7-A with NuttX, hardfloat
417+
`thumbv7a-pc-windows-msvc` | | |
418+
[`thumbv7a-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | | |
417419
[`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX
418420
[`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX, hardfloat
419421
[`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7M with NuttX
420422
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.5
423+
[`thumbv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | | Thumb-mode Bare Armv7-R
424+
[`thumbv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | | Thumb-mode Bare Armv7-R, hardfloat
421425
[`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX
422426
[`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX
423427
[`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat
428+
[`thumbv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | | Thumb-mode Bare Armv8-R, hardfloat
424429
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
425430
[`wasm32-wali-linux-musl`](platform-support/wasm32-wali-linux.md) | ? | | WebAssembly with [WALI](https://github.com/arjunr2/WALI)
426431
[`wasm32-wasip3`](platform-support/wasm32-wasip3.md) | ✓ | | WebAssembly with WASIp3

src/doc/rustc/src/platform-support/armv7a-none-eabi.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# `armv7a-none-eabi` and `armv7a-none-eabihf`
1+
# `armv7a-none-eabi` and `thumbv7a-none-eabihf`
22

3-
* **Tier: 2**
3+
* **Tier: 2** (`armv7a-none-eabi`)
4+
* **Tier: 3** (`thumbv7a-none-eabi`)
45
* **Library Support:** core and alloc (bare-metal, `#![no_std]`)
56

6-
Bare-metal target for CPUs in the Armv7-A architecture family, supporting
7-
dual ARM/Thumb mode, with ARM mode as the default.
7+
Bare-metal target for CPUs in the Armv7-A architecture family, supporting dual
8+
ARM/Thumb mode. The `armv7a-none-eabi` target uses Arm mode by default and
9+
the `thumbv7a-none-eabihf` target uses Thumb mode by default.
810

911
Note, this is for processors running in AArch32 mode. For the AArch64 mode
1012
added in Armv8-A, see [`aarch64-unknown-none`](aarch64-unknown-none.md) instead.

src/doc/rustc/src/platform-support/armv7r-none-eabi.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# `armv7r-none-eabi` and `armv7r-none-eabihf`
22

3-
* **Tier: 2**
3+
* **Tier: 2** (`armv7r-none-eabi`)
4+
* **Tier: 3** (`thumbv7r-none-eabi`)
45
* **Library Support:** core and alloc (bare-metal, `#![no_std]`)
56

6-
Bare-metal target for CPUs in the Armv7-R architecture family, supporting
7-
dual ARM/Thumb mode, with ARM mode as the default.
7+
Bare-metal target for CPUs in the Armv7-R architecture family, supporting dual
8+
ARM/Thumb mode. The `armv7r-none-eabi` target uses Arm mode by default and
9+
the `thumbv7r-none-eabihf` target uses Thumb mode by default.
810

911
Processors in this family include the [Arm Cortex-R4, 5, 7, and 8][cortex-r].
1012

0 commit comments

Comments
 (0)