On 6/6/13 9:00 AM, Richard Earnshaw wrote: > The pipeline offset is 4 for Thumb2 as well. So at the very least you > need to explain why your change doesn't apply then as well.
Yes some context is lost in that comment. Thunks are usually emitted in ARM mode, except for Thumb-only targets. Is the new comment OK? If so, please check it in since I do not have SVN write access. Thanks, Cesar 2013-06-07 Julian Brown <jul...@codesourcery.com> Cesar Philippidis <ce...@codesourcery.com> gcc/ * config/arm/arm.c (arm_output_mi_thunk): Fix offset for TARGET_THUMB1_ONLY.
Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 199695) +++ gcc/config/arm/arm.c (working copy) @@ -25217,7 +25217,12 @@ { /* Output ".word .LTHUNKn-7-.LTHUNKPCn". */ rtx tem = XEXP (DECL_RTL (function), 0); - tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7)); + /* When supported, thunks are generated in ARM mode. But for + TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC + pipeline offset is four rather than eight. Adjust the + offset accordingly. */ + tem = gen_rtx_PLUS (GET_MODE (tem), tem, + GEN_INT (TARGET_THUMB1_ONLY ? -3 : -7)); tem = gen_rtx_MINUS (GET_MODE (tem), tem, gen_rtx_SYMBOL_REF (Pmode,