This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM thumb: why call_via_rX?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]