1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};

/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
///
/// Requires the devkitARM toolchain for 3DS targets on the host system.

pub fn target() -> Target {
    let pre_link_args = TargetOptions::link_args(
        LinkerFlavor::Gnu(Cc::Yes, Lld::No),
        &["-specs=3dsx.specs", "-mtune=mpcore", "-mfloat-abi=hard", "-mtp=soft"],
    );

    Target {
        llvm_target: "armv6k-none-eabihf".into(),
        pointer_width: 32,
        data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
        arch: "arm".into(),

        options: TargetOptions {
            os: "horizon".into(),
            env: "newlib".into(),
            vendor: "nintendo".into(),
            abi: "eabihf".into(),
            cpu: "mpcore".into(),
            families: cvs!["unix"],
            linker: Some("arm-none-eabi-gcc".into()),
            relocation_model: RelocModel::Static,
            features: "+vfp2".into(),
            pre_link_args,
            exe_suffix: ".elf".into(),
            no_default_libraries: false,
            // There are some issues in debug builds with this enabled in certain programs.
            has_thread_local: false,
            ..Default::default()
        },
    }
}