This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ARM/THUMB long calls stubs
- From: Sami Kantoluoto <sami dot kantoluoto at embedtronics dot fi>
- To: Nick Clifton <nickc at redhat dot com>
- 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:29 +0300
- Subject: ARM/THUMB long calls stubs
Hi,
Found following post from the archive (as I'm having the same problem):
---8<---------8<----
Hi Richard,
> The whole point of the _call_via instructions is to get the current PC in
> r14 without losing the Thumb bit. This can only be do with a BL
> instruction, so we must call something. If it weren't for the fact that
> mov lr, pc lost the thumb bit we could just write
>
> mov lr, pc
> bx Rn
Doh! I forgot about that. So my recent suggested patch is not going
to work because the return address will be incorrect. Darn.
Cheers
Nick
---8<---------8<----
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:
And maybe following in ARM mode:
bl 1f
1: add lr,lr,#8 /* is this ok? */
bx Rn
Not very optimal but could work (?).
-sk