Skip to content

Commit 36f3083

Browse files
Auto merge of #149531 - Zalathar:rollup-15y580s, r=<try>
Rollup of 8 pull requests try-job: x86_64-msvc-1 try-job: i686-msvc-1 try-job: x86_64-mingw-1 try-job: test-various try-job: armhf-gnu try-job: aarch64-apple try-job: dist-various-1
2 parents 4ad239f + e168509 commit 36f3083

40 files changed

+386
-511
lines changed

compiler/rustc_target/src/spec/base/thumb.rs renamed to compiler/rustc_target/src/spec/base/arm_none.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,4 @@
1-
// These `thumbv*` targets cover the ARM Cortex-M family of processors which are widely used in
2-
// microcontrollers. Namely, all these processors:
3-
//
4-
// - Cortex-M0
5-
// - Cortex-M0+
6-
// - Cortex-M1
7-
// - Cortex-M3
8-
// - Cortex-M4(F)
9-
// - Cortex-M7(F)
10-
// - Cortex-M23
11-
// - Cortex-M33
12-
//
13-
// We have opted for these instead of one target per processor (e.g., `cortex-m0`, `cortex-m3`,
14-
// etc) because the differences between some processors like the cortex-m0 and cortex-m1 are almost
15-
// nonexistent from the POV of codegen so it doesn't make sense to have separate targets for them.
16-
// And if differences exist between two processors under the same target, rustc flags can be used to
17-
// optimize for one processor or the other.
18-
//
19-
// Also, we have not chosen a single target (`arm-none-eabi`) like GCC does because this makes
20-
// difficult to integrate Rust code and C code. Targeting the Cortex-M4 requires different gcc flags
21-
// than the ones you would use for the Cortex-M0 and with a single target it'd be impossible to
22-
// differentiate one processor from the other.
23-
//
24-
// About arm vs thumb in the name. The Cortex-M devices only support the Thumb instruction set,
25-
// which is more compact (higher code density), and not the ARM instruction set. That's why LLVM
26-
// triples use thumb instead of arm. We follow suit because having thumb in the name let us
27-
// differentiate these targets from our other `arm(v7)-*-*-gnueabi(hf)` targets in the context of
28-
// build scripts / gcc flags.
1+
// These are the baseline settings for 32-bit bare-metal Arm targets using the EABI or EABIHF ABI.
292

303
use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, PanicStrategy, RelocModel, TargetOptions};
314

compiler/rustc_target/src/spec/base/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pub(crate) mod aix;
22
pub(crate) mod android;
33
pub mod apple;
4+
pub(crate) mod arm_none;
45
pub(crate) mod avr;
56
pub(crate) mod bpf;
67
pub(crate) mod cygwin;
@@ -31,7 +32,6 @@ pub(crate) mod redox;
3132
pub(crate) mod solaris;
3233
pub(crate) mod solid;
3334
pub(crate) mod teeos;
34-
pub(crate) mod thumb;
3535
pub(crate) mod uefi_msvc;
3636
pub(crate) mod unikraft_linux_musl;
3737
pub(crate) mod vxworks;

compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
//! The default link script is very likely wrong, so you should use
1010
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12-
use crate::spec::{
13-
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
14-
TargetOptions, cvs,
15-
};
12+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
1613

1714
pub(crate) fn target() -> Target {
1815
Target {
@@ -25,35 +22,16 @@ pub(crate) fn target() -> Target {
2522
},
2623
pointer_width: 32,
2724
arch: Arch::Arm,
28-
/* Data layout args are '-' separated:
29-
* little endian
30-
* stack is 64-bit aligned (EABI)
31-
* pointers are 32-bit
32-
* i64 must be 64-bit aligned (EABI)
33-
* mangle names with ELF style
34-
* native integers are 32-bit
35-
* All other elements are default
36-
*/
3725
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
3826
options: TargetOptions {
3927
abi: Abi::Eabi,
4028
llvm_floatabi: Some(FloatAbi::Soft),
41-
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
42-
linker: Some("rust-lld".into()),
4329
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
44-
// Force-enable 32-bit atomics, which allows the use of atomic load/store only.
45-
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
46-
features: "+soft-float,+strict-align,+atomics-32".into(),
47-
main_needs_argc_argv: false,
30+
features: "+soft-float,+strict-align".into(),
4831
atomic_cas: false,
32+
max_atomic_width: Some(0),
4933
has_thumb_interworking: true,
50-
relocation_model: RelocModel::Static,
51-
panic_strategy: PanicStrategy::Abort,
52-
// From thumb_base, rust-lang/rust#44993.
53-
emit_debug_gdb_scripts: false,
54-
// From thumb_base, GCC gives enums a minimum of 8 bits on no-os targets.
55-
c_enum_min_bits: Some(8),
56-
..Default::default()
34+
..base::arm_none::opts()
5735
},
5836
}
5937
}
Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Targets the ARMv5TE, with code as `a32` code by default.
22
3-
use crate::spec::{
4-
Abi, Arch, FloatAbi, FramePointer, Target, TargetMetadata, TargetOptions, base, cvs,
5-
};
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
64

75
pub(crate) fn target() -> Target {
86
Target {
@@ -15,36 +13,16 @@ pub(crate) fn target() -> Target {
1513
},
1614
pointer_width: 32,
1715
arch: Arch::Arm,
18-
/* Data layout args are '-' separated:
19-
* little endian
20-
* stack is 64-bit aligned (EABI)
21-
* pointers are 32-bit
22-
* i64 must be 64-bit aligned (EABI)
23-
* mangle names with ELF style
24-
* native integers are 32-bit
25-
* All other elements are default
26-
*/
2716
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
28-
2917
options: TargetOptions {
3018
abi: Abi::Eabi,
3119
llvm_floatabi: Some(FloatAbi::Soft),
32-
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
33-
// * activate t32/a32 interworking
34-
// * use arch ARMv5TE
35-
// * use little-endian
3620
asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
37-
// minimum extra features, these cannot be disabled via -C
38-
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
39-
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
40-
features: "+soft-float,+strict-align,+atomics-32".into(),
41-
frame_pointer: FramePointer::MayOmit,
42-
main_needs_argc_argv: false,
43-
// don't have atomic compare-and-swap
21+
features: "+soft-float,+strict-align".into(),
4422
atomic_cas: false,
23+
max_atomic_width: Some(0),
4524
has_thumb_interworking: true,
46-
47-
..base::thumb::opts()
25+
..base::arm_none::opts()
4826
},
4927
}
5028
}

compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
//! The default link script is very likely wrong, so you should use
1010
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12-
use crate::spec::{
13-
Abi, Arch, FloatAbi, FramePointer, PanicStrategy, RelocModel, Target, TargetMetadata,
14-
TargetOptions, base, cvs,
15-
};
12+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
1613

1714
pub(crate) fn target() -> Target {
1815
Target {
@@ -25,44 +22,16 @@ pub(crate) fn target() -> Target {
2522
},
2623
pointer_width: 32,
2724
arch: Arch::Arm,
28-
/* Data layout args are '-' separated:
29-
* little endian
30-
* stack is 64-bit aligned (EABI)
31-
* pointers are 32-bit
32-
* i64 must be 64-bit aligned (EABI)
33-
* mangle names with ELF style
34-
* native integers are 32-bit
35-
* All other elements are default
36-
*/
3725
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
3826
options: TargetOptions {
3927
abi: Abi::Eabi,
4028
llvm_floatabi: Some(FloatAbi::Soft),
41-
42-
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
43-
// * activate t32/a32 interworking
44-
// * use arch ARMv4T
45-
// * use little-endian
4629
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
47-
48-
// minimum extra features, these cannot be disabled via -C
49-
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
50-
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
51-
features: "+soft-float,+strict-align,+atomics-32".into(),
52-
53-
panic_strategy: PanicStrategy::Abort,
54-
relocation_model: RelocModel::Static,
55-
// suggested from thumb_base, rust-lang/rust#44993.
56-
emit_debug_gdb_scripts: false,
57-
frame_pointer: FramePointer::MayOmit,
58-
59-
main_needs_argc_argv: false,
60-
61-
// don't have atomic compare-and-swap
30+
features: "+soft-float,+strict-align".into(),
6231
atomic_cas: false,
32+
max_atomic_width: Some(0),
6333
has_thumb_interworking: true,
64-
65-
..base::thumb::opts()
34+
..base::arm_none::opts()
6635
},
6736
}
6837
}
Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Targets the ARMv5TE, with code as `t32` code by default.
22
3-
use crate::spec::{
4-
Abi, Arch, FloatAbi, FramePointer, Target, TargetMetadata, TargetOptions, base, cvs,
5-
};
3+
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
64

75
pub(crate) fn target() -> Target {
86
Target {
@@ -15,36 +13,16 @@ pub(crate) fn target() -> Target {
1513
},
1614
pointer_width: 32,
1715
arch: Arch::Arm,
18-
/* Data layout args are '-' separated:
19-
* little endian
20-
* stack is 64-bit aligned (EABI)
21-
* pointers are 32-bit
22-
* i64 must be 64-bit aligned (EABI)
23-
* mangle names with ELF style
24-
* native integers are 32-bit
25-
* All other elements are default
26-
*/
2716
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
28-
2917
options: TargetOptions {
3018
abi: Abi::Eabi,
3119
llvm_floatabi: Some(FloatAbi::Soft),
32-
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
33-
// * activate t32/a32 interworking
34-
// * use arch ARMv5TE
35-
// * use little-endian
3620
asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
37-
// minimum extra features, these cannot be disabled via -C
38-
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
39-
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
40-
features: "+soft-float,+strict-align,+atomics-32".into(),
41-
frame_pointer: FramePointer::MayOmit,
42-
main_needs_argc_argv: false,
43-
// don't have atomic compare-and-swap
21+
features: "+soft-float,+strict-align".into(),
4422
atomic_cas: false,
23+
max_atomic_width: Some(0),
4524
has_thumb_interworking: true,
46-
47-
..base::thumb::opts()
25+
..base::arm_none::opts()
4826
},
4927
}
5028
}

compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) fn target() -> Target {
2626
// There are no atomic CAS instructions available in the instruction set of the ARMv6-M
2727
// architecture
2828
atomic_cas: false,
29-
..base::thumb::opts()
29+
..base::arm_none::opts()
3030
},
3131
}
3232
}

compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(crate) fn target() -> Target {
2525
// The ARMv6-M doesn't support hardware atomic operations, use atomic builtins instead.
2626
features: "+strict-align".into(),
2727
max_atomic_width: Some(32),
28-
..base::thumb::opts()
28+
..base::arm_none::opts()
2929
},
3030
}
3131
}

compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub(crate) fn target() -> Target {
2727
// Cortex-A7/A8/A9 with software floating point
2828
features: "+soft-float,-neon".into(),
2929
max_atomic_width: Some(64),
30-
..base::thumb::opts()
30+
..base::arm_none::opts()
3131
},
3232
}
3333
}

compiler/rustc_target/src/spec/targets/thumbv7a_nuttx_eabihf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub(crate) fn target() -> Target {
3131
// and NEON SIMD instructions
3232
features: "+vfp3,+neon".into(),
3333
max_atomic_width: Some(64),
34-
..base::thumb::opts()
34+
..base::arm_none::opts()
3535
},
3636
}
3737
}

0 commit comments

Comments
 (0)