diff --git a/deps/gbastartup/cstartup.cpp b/deps/gbastartup/cstartup.cpp index 481e9105..72ba9acb 100644 --- a/deps/gbastartup/cstartup.cpp +++ b/deps/gbastartup/cstartup.cpp @@ -1,10 +1,15 @@ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" + extern void (*__preinit_array_start[]) (void); extern void (*__preinit_array_end[]) (void); extern void (*__init_array_start[]) (void); extern void (*__init_array_end[]) (void); -extern "C" void __libc_init_array() { +extern "C" { + +void __libc_init_array() { auto preInits = __preinit_array_end - __preinit_array_start; for (decltype(preInits) i = 0; i < preInits; i++) { __preinit_array_start[i](); @@ -14,3 +19,14 @@ extern "C" void __libc_init_array() { __preinit_array_start[i](); } } + +int main(int argc, const char **argv); + +void c_start() { + const char *args[2] = {"", "rom.oxfs"}; + main(2, args); +} + +} + +#pragma GCC diagnostic pop diff --git a/deps/gbastartup/gba_crt0.s b/deps/gbastartup/gba_crt0.s index a0816b5d..49e6e8a8 100644 --- a/deps/gbastartup/gba_crt0.s +++ b/deps/gbastartup/gba_crt0.s @@ -183,9 +183,7 @@ CEW0Skip: @--------------------------------------------------------------------------------- @ Jump to user code @--------------------------------------------------------------------------------- - mov r0, #0 @ int argc - mov r1, #0 @ char *argv[] - ldr r3, =main + ldr r3, =c_start bl _blx_r3_stub @--------------------------------------------------------------------------------- @ Clear memory to 0x00 if length != 0