This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM thumb: why call_via_rX?
- From: Phil Blundell <pb at nexus dot co dot uk>
- To: Adrian von Bidder <avbidder at acter dot ch>
- Cc: gcc devel mailing list <gcc at gcc dot gnu dot org>
- Date: 25 Jan 2002 10:41:48 +0000
- Subject: Re: ARM thumb: why call_via_rX?
- References: <1011954323.20978.5.camel@atlas>
On Fri, 2002-01-25 at 10:25, Adrian von Bidder wrote:
> Why are calls through function pointers made with the call_via_rX stubs
> on ARM/thumb? couldn't gcc just generate the bx rX operation inline?
I think this is so that the return address gets set up right. If you do
mov lr, pc
bx my_func
in Thumb mode, the saved "pc" won't have bit zero set and the return
from "my_func" will cause a spurious switch back to ARM mode if it's
interworking-enabled. I guess this is the problem that "blx" was
intended to solve.
If you aren't doing interworking, at least for the callee, then there
might not be an issue. I don't know if you can communicate this to GCC
at the moment though.
> The call_via_rX stubs are problematic for me because one program I
> should get to work does some fancy copying of code at runtime - where,
> of course, calls with relative addresses fail. Calls through function
> pointers have so far (in ARM) worked.
Are you saying that any "b" or "bl" instruction is verboten? Perhaps
you could be a bit more concrete about what's going on.
p.