Skip to content

Commit 5c63bff

Browse files
committed
Make the new target a general thumbv4t target.
1 parent fba90f9 commit 5c63bff

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/librustc_target/spec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ supported_targets! {
676676
("powerpc64-wrs-vxworks", powerpc64_wrs_vxworks),
677677

678678
("mipsel-sony-psp", mipsel_sony_psp),
679-
("thumbv4t-nintendo-gba", thumbv4t_nintendo_gba),
679+
("thumbv4t-none-eabi", thumbv4t_none_eabi),
680680
}
681681

682682
/// Everything `rustc` knows about how to compile for a specific target.

src/librustc_target/spec/thumbv4t_nintendo_gba.rs renamed to src/librustc_target/spec/thumbv4t_none_eabi.rs

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
//! Targets the Nintendo Game Boy Advance (GBA),
2-
//! a handheld game device from 2001.
1+
//! Targets the ARMv4T, with code as `t32` code by default.
2+
//!
3+
//! Primarily of use for the GBA, but usable with other devices too.
34
//!
45
//! Please ping @Lokathor if changes are needed.
56
//!
6-
//! The target profile assumes that you have the ARM binutils in your path (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager
7+
//! This target profile assumes that you have the ARM binutils in your path (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager. Unfortunately, the standard linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we must use the GNU `ld` linker.
78
//!
8-
//! **Important:** This target profile **does not** specify a linker script or the ROM header. You'll still need to provide these yourself to construct a final binary. Generally you'd do this with something like `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`.
9+
//! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
910
1011
use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult};
1112

@@ -16,8 +17,8 @@ pub fn target() -> TargetResult {
1617
target_pointer_width: "32".to_string(),
1718
target_c_int_width: "32".to_string(),
1819
target_os: "none".to_string(),
19-
target_env: "gba".to_string(),
20-
target_vendor: "nintendo".to_string(),
20+
target_env: "".to_string(),
21+
target_vendor: "".to_string(),
2122
arch: "arm".to_string(),
2223
/* Data layout args are '-' separated:
2324
* little endian
@@ -34,10 +35,15 @@ pub fn target() -> TargetResult {
3435
linker: Some("arm-none-eabi-ld".to_string()),
3536
linker_is_gnu: true,
3637

37-
// extra args passed to the external assembler
38-
asm_args: vec!["-mcpu=arm7tdmi".to_string(), "-mthumb-interwork".to_string()],
39-
40-
cpu: "arm7tdmi".to_string(),
38+
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
39+
// * activate t32/a32 interworking
40+
// * use arch ARMv4T
41+
// * use little-endian
42+
asm_args: vec![
43+
"-mthumb-interwork".to_string(),
44+
"-march=armv4t".to_string(),
45+
"-mlittle-endian".to_string(),
46+
],
4147

4248
// minimum extra features, these cannot be disabled via -C
4349
features: "+soft-float,+strict-align".to_string(),
@@ -48,7 +54,7 @@ pub fn target() -> TargetResult {
4854

4955
main_needs_argc_argv: false,
5056

51-
// if we have thread-local storage
57+
// No thread-local storage (just use a static Cell)
5258
has_elf_tls: false,
5359

5460
// don't have atomic compare-and-swap
@@ -60,7 +66,7 @@ pub fn target() -> TargetResult {
6066
// ABIs to not use
6167
unsupported_abis: super::arm_base::unsupported_abis(),
6268

63-
// this is off just like in the `thumb_base`
69+
// this is turned off just like in the `thumb_base` module
6470
emit_debug_gdb_scripts: false,
6571

6672
..TargetOptions::default()

0 commit comments

Comments
 (0)