diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN gcc-4.7.3.pre/libgcc/config/arm/bpabi.S gcc-4.7.3/libgcc/config/arm/bpabi.S --- gcc-4.7.3.pre/libgcc/config/arm/bpabi.S 2011-11-02 15:03:19.000000000 +0000 +++ gcc-4.7.3/libgcc/config/arm/bpabi.S 2013-10-07 23:39:05.508083589 +0100 @@ -133,10 +133,25 @@ ARM_FUNC_START aeabi_ldivmod #else do_push {sp, lr} #endif +#if defined(__INTERWORKING_STUBS__) + /* In this case, __gnu_ldivmod_helper is compiled in Thumb mode, but + without interworking. This means it needs to be called in Thumb + mode, and will return in Thumb mode, not ARM. So we handle that. */ + orr ip, pc, #1 + bx ip + .code 16 + bl SYM(__gnu_ldivmod_helper) __PLT__ + ldr r2, [sp, #4] + mov lr, r2 + ldr r2, [sp, #8] + ldr r3, [sp, #12] + add sp, sp, #16 +#else bl SYM(__gnu_ldivmod_helper) __PLT__ ldr lr, [sp, #4] add sp, sp, #8 do_pop {r2, r3} +#endif RET #endif /* L_aeabi_ldivmod */ @@ -153,10 +168,25 @@ ARM_FUNC_START aeabi_uldivmod #else do_push {sp, lr} #endif +#if defined(__INTERWORKING_STUBS__) + /* In this case, __gnu_uldivmod_helper is compiled in Thumb mode, but + without interworking. This means it needs to be called in Thumb + mode, and will return in Thumb mode, not ARM. So we handle that. */ + orr ip, pc, #1 + bx ip + .code 16 + bl SYM(__gnu_uldivmod_helper) __PLT__ + ldr r2, [sp, #4] + mov lr, r2 + ldr r2, [sp, #8] + ldr r3, [sp, #12] + add sp, sp, #16 +#else bl SYM(__gnu_uldivmod_helper) __PLT__ ldr lr, [sp, #4] add sp, sp, #8 do_pop {r2, r3} +#endif RET #endif /* L_aeabi_divmod */