Skip to content

Commit e190bdf

Browse files
committed
fill in all those options.
1 parent 48ec236 commit e190bdf

File tree

1 file changed

+61
-11
lines changed

1 file changed

+61
-11
lines changed

src/librustc_target/spec/thumbv4t_nintendo_gba.rs

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
//! Targets the Nintendo Game Boy Advance (GBA).
1+
//! Targets the Nintendo Game Boy Advance (GBA), a handheld game device from 2001.
22
//!
3-
//! The GBA is a handheld game device from 2001. Inside, the CPU is an ARM7TDMI.
4-
//! That's in the ARMv4T architecture family.
3+
//! Please ping @Lokathor if changes are needed.
54
//!
6-
//! Technically the device has no OS, however we're going to copy the
7-
//! `mipsel_sony_psp` target setup and set the OS string to be "GBA". Other than
8-
//! the setting of the `target_os` and `target_vendor` values, this target is a
9-
//! fairly standard configuration for `thumbv4t`
5+
//! Important: This target **does not** specify a linker script or the ROM
6+
//! header. You'll still need to provide these yourself to construct a final
7+
//! binary. Generally you'd do this with something like
8+
//! `-Clink-arg=-Tmy_script.ld` and `-Clink-arg=my_crt.o`.
109
1110
use crate::spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult};
1211

@@ -16,14 +15,65 @@ pub fn target() -> TargetResult {
1615
target_endian: "little".to_string(),
1716
target_pointer_width: "32".to_string(),
1817
target_c_int_width: "32".to_string(),
19-
target_os: "gba".to_string(),
20-
target_env: String::new(),
18+
target_os: "none".to_string(),
19+
target_env: "gba".to_string(),
2120
target_vendor: "nintendo".to_string(),
2221
arch: "arm".to_string(),
23-
data_layout: "TODO".to_string(),
22+
/* Data layout args are '-' separated:
23+
* little endian
24+
* stack is 64-bit aligned (EABI)
25+
* pointers are 32-bit
26+
* i64 must be 64-bit aligned (EABI)
27+
* mangle names with ELF style
28+
* native integers are 32-bit
29+
* All other elements are default
30+
*/
31+
data_layout: "e-S64-p:32:32-i64:64-m:e-n32".to_string(),
2432
linker_flavor: LinkerFlavor::Ld,
2533
options: TargetOptions {
26-
// TODO
34+
linker: Some("arm-none-eabi-ld".to_string()),
35+
linker_is_gnu: true,
36+
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(),
41+
42+
// minimum extra features, these cannot be disabled via -C
43+
features: "+soft-float,+strict-align".to_string(),
44+
45+
executables: true,
46+
47+
relocation_model: RelocModel::Static,
48+
49+
//function_sections: bool,
50+
//exe_suffix: String,
51+
main_needs_argc_argv: false,
52+
53+
// if we have thread-local storage
54+
has_elf_tls: false,
55+
56+
// don't have atomic compare-and-swap
57+
atomic_cas: false,
58+
59+
// always just abort
60+
panic_strategy: PanicStrategy::Abort,
61+
62+
// ABIs to not use
63+
unsupported_abis: super::arm_base::unsupported_abis(),
64+
65+
// The minimum alignment for global symbols.
66+
min_global_align: Some(4),
67+
68+
// no threads here
69+
singlethread: true,
70+
71+
// GBA has no builtins
72+
no_builtins: true,
73+
74+
// this is off just like in the `thumb_base`
75+
emit_debug_gdb_scripts: false,
76+
2777
..TargetOptions::default()
2878
},
2979
})

0 commit comments

Comments
 (0)