Hi Richard, Ramana,

Attached is a small fix for resolving a g++.old-deja/g++.jason/thunk2.C
regression we found under a TARGET_THUMB1_ONLY multilib (-mthumb
-march=armv6-m to be exact). Basically under those conditions, the thunk
is in Thumb mode, so the subtraction should be 4 rather than 8.

Original patch was by Julian, with trivial adaptations for trunk by me.
We've been carrying this fix for a while by now. Okay for trunk? (and
stable branches?)

Thanks,
Chung-Lin

2014-06-08  Julian Brown  <jul...@codesourcery.com>
            Chung-Lin Tang  <clt...@codesourcery.com>

        * config/arm/arm.c (arm_output_mi_thunk): Fix offset for
        TARGET_THUMB1_ONLY. Add comments.
Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 211353)
+++ config/arm/arm.c	(working copy)
@@ -28428,9 +28428,13 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIB
       fputs (":\n", file);
       if (flag_pic)
 	{
-	  /* Output ".word .LTHUNKn-7-.LTHUNKPCn".  */
+	  /* Output ".word .LTHUNKn-[37]-.LTHUNKPCn".  */
 	  rtx tem = XEXP (DECL_RTL (function), 0);
-	  tem = plus_constant (GET_MODE (tem), tem, -7);
+	  /* 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 = plus_constant (GET_MODE (tem), tem,
+			       TARGET_THUMB1_ONLY ? -3 : -7);
 	  tem = gen_rtx_MINUS (GET_MODE (tem),
 			       tem,
 			       gen_rtx_SYMBOL_REF (Pmode,

Reply via email to