Eric Warmenhoven baba2fe452
3ds: fix scummvm core build
Change the direct bl initSystem to a register-indirect call

f724cc370f added -ffunction-sections -fdata-sections and -Wl,--gc-sections to Makefile.ctr. While this saves ~160KB RAM by enabling dead code elimination, it has a side effect: every function now gets its own ELF section (e.g. initSystem goes into .text.initSystem). The linker is free to place these sections in any order, and with a large core like ScummVM, initSystem ends up >32MB from the .crt0 section at the start of the binary.

The ARM bl (branch-with-link) instruction at line 43 of 3dsx_custom_crt0.s only has a +/- 32MB range. When initSystem is beyond that range, the linker emits relocation truncated to fit: R_ARM_CALL.

This fix uses the same pattern already used for main (lines 52-54: ldr r3, =main; bx r3). The ldr r2, =initSystem loads the absolute address from a literal pool, and blx r2 branches to it with no range limitation. The bl ClearMem call is fine because ClearMem is defined locally within the .crt0 section.
2026-02-24 11:52:33 -05:00
..
2026-02-24 11:52:33 -05:00