public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, ARM] MI-thunk fix for TARGET_THUMB1_ONLY
@ 2014-06-08 11:27 Chung-Lin Tang
  2014-06-17 22:26 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 3+ messages in thread
From: Chung-Lin Tang @ 2014-06-08 11:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Earnshaw, Ramana Radhakrishnan, Julian Brown

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

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  <julian@codesourcery.com>
            Chung-Lin Tang  <cltang@codesourcery.com>

	* config/arm/arm.c (arm_output_mi_thunk): Fix offset for
	TARGET_THUMB1_ONLY. Add comments.

[-- Attachment #2: armv6m-mi-thunk.patch --]
[-- Type: text/x-patch, Size: 837 bytes --]

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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, ARM] MI-thunk fix for TARGET_THUMB1_ONLY
  2014-06-08 11:27 [PATCH, ARM] MI-thunk fix for TARGET_THUMB1_ONLY Chung-Lin Tang
@ 2014-06-17 22:26 ` Ramana Radhakrishnan
  2014-06-20  6:24   ` Chung-Lin Tang
  0 siblings, 1 reply; 3+ messages in thread
From: Ramana Radhakrishnan @ 2014-06-17 22:26 UTC (permalink / raw)
  To: Chung-Lin Tang
  Cc: gcc-patches, Richard Earnshaw, Ramana Radhakrishnan, Julian Brown

On Sun, Jun 8, 2014 at 12:27 PM, Chung-Lin Tang <cltang@codesourcery.com> wrote:
> 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.

Yep, this is OK with a minor change to the comment to make it more explicit.

>+      /* Output ".word .LTHUNKn-[37]-.LTHUNKPCn".  */

s/37/3,7/


Ok with that change and if no regressions.

OK for release branches unless the RM's object in 24 hours.

It would be nice to see if we could rewrite the mi thunk code like
other backends but that's the matter of a separate patch.

Ramana
>
> 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  <julian@codesourcery.com>
>             Chung-Lin Tang  <cltang@codesourcery.com>
>
>         * config/arm/arm.c (arm_output_mi_thunk): Fix offset for
>         TARGET_THUMB1_ONLY. Add comments.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, ARM] MI-thunk fix for TARGET_THUMB1_ONLY
  2014-06-17 22:26 ` Ramana Radhakrishnan
@ 2014-06-20  6:24   ` Chung-Lin Tang
  0 siblings, 0 replies; 3+ messages in thread
From: Chung-Lin Tang @ 2014-06-20  6:24 UTC (permalink / raw)
  To: ramrad01
  Cc: gcc-patches, Richard Earnshaw, Ramana Radhakrishnan, Julian Brown

On 2014/6/18 上午 06:26, Ramana Radhakrishnan wrote:
> On Sun, Jun 8, 2014 at 12:27 PM, Chung-Lin Tang <cltang@codesourcery.com> wrote:
>> > 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.
> Yep, this is OK with a minor change to the comment to make it more explicit.
> 
>> >+      /* Output ".word .LTHUNKn-[37]-.LTHUNKPCn".  */
> s/37/3,7/
> 
> 
> Ok with that change and if no regressions.
> 
> OK for release branches unless the RM's object in 24 hours.

Re-tested on a recent trunk, verified g++.jason/thunk2.C resolved with
patch and no regressions. Committed on trunk and backported to 4.8, 4.9
branches.

Thanks,
Chung-Lin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-20  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-08 11:27 [PATCH, ARM] MI-thunk fix for TARGET_THUMB1_ONLY Chung-Lin Tang
2014-06-17 22:26 ` Ramana Radhakrishnan
2014-06-20  6:24   ` Chung-Lin Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).