Browse Source

ARM: Fix BLX encoding for Thumb interworking calls.

Thanks to Charles Baylis.
Mike Pall 9 years ago
parent
commit
fcc8244899
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/lj_emit_arm.h

+ 1 - 1
src/lj_emit_arm.h

@@ -273,7 +273,7 @@ static void emit_call(ASMState *as, void *target)
   ptrdiff_t delta = ((char *)target - (char *)p) - 8;
   if ((((delta>>2) + 0x00800000) >> 24) == 0) {
     if ((delta & 1))
-      *p = ARMI_BLX | ((uint32_t)(delta>>2) & 0x00ffffffu) | ((delta&2) << 27);
+      *p = ARMI_BLX | ((uint32_t)(delta>>2) & 0x00ffffffu) | ((delta&2) << 23);
     else
       *p = ARMI_BL | ((uint32_t)(delta>>2) & 0x00ffffffu);
   } else {  /* Target out of range: need indirect call. But don't use R0-R3. */