[arm] In the llvm throw corlib exception trampoline, use the normal caller ip instead...
authorZoltan Varga <vargaz@gmail.com>
Mon, 28 Mar 2016 19:50:35 +0000 (15:50 -0400)
committerZoltan Varga <vargaz@gmail.com>
Mon, 28 Mar 2016 19:50:35 +0000 (15:50 -0400)
mono/mini/exceptions-arm.c

index 366e086c8b3fe5e225d67979e8ec53eccb55e0bd..73e0f4d1b6d3d24b78f0343ae4b67cca23dedeaa 100644 (file)
@@ -247,9 +247,15 @@ get_throw_trampoline (int size, gboolean corlib, gboolean rethrow, gboolean llvm
        /* exc is already in place in r0 */
        if (corlib) {
                /* The caller ip is already in R1 */
-               if (llvm)
-                       /* Negate the ip adjustment done in mono_arm_throw_exception */
-                       ARM_ADD_REG_IMM8 (code, ARMREG_R1, ARMREG_R1, 4);
+               if (llvm) {
+                       /*
+                        * The address passed by llvm might point to before the call,
+                        * thus outside the eh range recorded by llvm. Use the return
+                        * address instead.
+                        * FIXME: Do this on more platforms.
+                        */
+                       ARM_MOV_REG_REG (code, ARMREG_R1, ARMREG_LR); /* caller ip */
+               }
        } else {
                ARM_MOV_REG_REG (code, ARMREG_R1, ARMREG_LR); /* caller ip */
        }