This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: ARM/THUMB long calls stubs
- From: Nick Clifton <nickc at redhat dot com>
- To: Sami Kantoluoto <sami dot kantoluoto at embedtronics dot fi>
- Cc: Andy Green <andy dot green at oxsemi dot com>, Richard Earnshaw <rearnsha at arm dot com>, gcc-bugs at gcc dot gnu dot org
- Date: Thu, 29 Jul 2004 16:58:31 +0100
- Subject: Re: ARM/THUMB long calls stubs
- References: <20040729135829.GA24137@embedtronics.fi>
Hi Sami,
Would it be hard to do patch (against gcc 3.4.1) to try following (thumb
mode):
bl 1f
b 2f
1: bx Rn
2:
Indeed - try the attached patch.
And maybe following in ARM mode:
bl 1f
1: add lr,lr,#8 /* is this ok? */
bx Rn
I do not think that this should be needed. The problem, if I recall
correctly, was that the call_via_... stub functions might have been out
of range of the Thumb's BL instruction. Since these stubs are not used
in ARM mode, there should be no need to synthesize a branch to them.
Cheers
Nick
PS. This patch will not be applied to the sources since the correct
thing to do is to fix this problem in the linker.
Index: gcc/config/arm/arm.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.md,v
retrieving revision 1.154
diff -c -3 -p -r1.154 arm.md
*** gcc/config/arm/arm.md 13 Jan 2004 13:24:37 -0000 1.154
--- gcc/config/arm/arm.md 29 Jul 2004 15:55:50 -0000
***************
*** 7203,7208 ****
--- 7203,7212 ----
{
if (TARGET_CALLER_INTERWORKING)
return \"bl\\t%__interwork_call_via_%0\";
+ else if (TARGET_LONG_CALLS)
+ /* For long calls the __call_via functions might not be near
+ this branch, so we have to synthesise their actions. */
+ return \"bl\\t0f\\n\\tb\\t1f\\n0:\\tbx\\t%1\\n1:\";
else
return \"bl\\t%__call_via_%0\";
}"
***************
*** 7220,7225 ****
--- 7224,7233 ----
{
if (TARGET_CALLER_INTERWORKING)
return \"bl\\t%__interwork_call_via_%1\";
+ else if (TARGET_LONG_CALLS)
+ /* For long calls the __call_via functions might not be near
+ this branch, so we have to synthesise their actions. */
+ return \"bl\\t0f\\n\\tb\\t1f\\n0:\\tbx\\t%1\\n1:\";
else
return \"bl\\t%__call_via_%1\";
}"