fix: made suggested changes to add a playdate subtarget, updated help text and reduce required build flags for playdate to just the subtarget, no-movt and cortex-m7 added to default on playdate subtarget flag.

This commit is contained in:
MauriceElliott
2026-07-01 21:18:28 +01:00
parent a3fa3476c6
commit 56cee0c2cf
5 changed files with 24 additions and 17 deletions

View File

@@ -171,6 +171,7 @@ enum Subtarget : u32 {
Subtarget_iPhone,
Subtarget_iPhoneSimulator,
Subtarget_Android,
Subtarget_Playdate,
Subtarget_COUNT,
Subtarget_Invalid, // NOTE(harold): Must appear after _COUNT as this is not a real subtarget
@@ -181,6 +182,7 @@ gb_global String subtarget_strings[Subtarget_COUNT] = {
str_lit("iphone"),
str_lit("iphonesimulator"),
str_lit("android"),
str_lit("playdate"),
};
@@ -1072,11 +1074,7 @@ gb_internal bool is_arch_wasm(void) {
return false;
}
gb_internal bool is_cortex_m7(void) {
return build_context.metrics.os == TargetOs_freestanding &&
build_context.metrics.arch == TargetArch_arm32 &&
build_context.microarch == str_lit("cortex-m7");
}
gb_internal bool is_arch_x86(void) {
switch (build_context.metrics.arch) {
@@ -1838,10 +1836,6 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
bc->metrics = *metrics;
if (is_cortex_m7()) {
bc->metrics.target_triplet = str_lit("thumbv7em-none-eabihf");
}
bc->ODIN_OS = target_os_names[metrics->os];
bc->ODIN_ARCH = target_arch_names[metrics->arch];
bc->endian_kind = target_endians[metrics->arch];
@@ -1967,6 +1961,16 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
bc->no_plt = LLVM_VERSION_MAJOR >= 19;
break;
}
} else if (subtarget == Subtarget_Playdate) {
// Playdate uses the cortex-m7 as well and an FPU, requiring thumb instructions and hard floats.
bc->microarch = str_lit("cortex-m7");
bc->metrics.target_triplet = str_lit("thumbv7em-none-eabihf");
// Remove MOVW/MOVT instructions as playdate only handles R_ARM_ABS32 relocations.
if(bc->target_features_string.len > 0) {
bc->target_features_string = concatenate_strings(permanent_allocator(), bc->target_features_string, str_lit(",no-movt"));
} else {
bc->target_features_string = str_lit("no-movt");
}
}
if (metrics->os == TargetOs_windows ||