Unfortunately, libgcc uses this instruction a few times:
_aeabi_ldivmod
_aeabi_uldivmod
_arm_cmpdf2
_arm_cmpsf2
libunwind
For example, in _aeabi_ldivmod:
Code: Select all
2c: e92d6000 push {sp, lr}
30: ebfffffe bl 0 <__gnu_ldivmod_helper>
In the ldivmod helper:
Code: Select all
20: 9a08 ldr r2, [sp, #32]
22: 1a1b subs r3, r3, r0
24: 418c sbcs r4, r1
26: 6013 str r3, [r2, #0]
28: 6054 str r4, [r2, #4]
In NO$GBA, this overwrites the return address and it jumps to something invalid (I saw it return to address 00000000).
So is it possible to get rid of the "Store the stack pointer onto the stack" thing that libgcc is using, so code that divides 64-bit integers will work correctly on NO$GBA?