wingo pushed a commit to branch master in repository guile. commit 0ff3b3163c3bf7bc9b498403428999deb771d2cd Author: Icecream95 <i...@keemail.me> AuthorDate: Thu Apr 9 21:32:55 2020 +1200
Convert BLI to BLXI for jumps to ARM code With this, Guile builds and runs in both ARM and Thumb mode. Closes: #12 --- lightening/arm-cpu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lightening/arm-cpu.c b/lightening/arm-cpu.c index 1bb7394..0e38883 100644 --- a/lightening/arm-cpu.c +++ b/lightening/arm-cpu.c @@ -316,7 +316,13 @@ encode_thumb_jump(int32_t v) static uint32_t patch_thumb_jump(uint32_t inst, int32_t v) { - return (inst & thumb_jump_mask) | encode_thumb_jump(v); + inst &= thumb_jump_mask; + if (!(v & 1)) { + ASSERT(inst == THUMB2_BLI || inst == THUMB2_BLXI); + v = (v + 2) & ~2; + inst = THUMB2_BLXI; + } + return inst | encode_thumb_jump(v); } static int32_t