Instruction set is not exchanged when needed while calling native code on ARM
For calli, jmpi and jmpr (possibly more, I only checked the tests), adding __attribute__ ((target("thumb")))
before functions which are called from the JIT'd code is required or bad things happen (the CPU executes ARM code while in Thumb mode, and either ends up in an infinite loop, dumping core or deleting all your files).
[The reason why you haven't noticed this yet is because Debian has GCC set to compile all functions as thumb anyway (-mthumb
)]
Someone with more experience with ARM assembly than me should probably fix lightening (does upstream lightning need this too?) to support calling ARM code from the generated Thumb code, using BL?X instructions.
That, or being lazy and hoping making Guile compile with -mthumb
when on ARM won't affect performance too much.