ARM thumb interworking hole?
Richard Earnshaw
rearnsha@gcc.gnu.org
Mon Jan 10 12:37:00 GMT 2005
On Mon, 2005-01-10 at 04:31, Charles Manning wrote:
> I've read up what I can on this, and seen the "it's a binutils problem" style
> responses too, but I see something still that seems to me a hole in the
> current interworking strategy.
>
> I'm compiling thumb with -mthumb -mthumb-interwork -mlong-calls
>
> I'm using -mlong-calls because the code is split between two memory areas
> which are more than 4MB apart.
>
> If I have code that calls a function per function pointer then code is
> generated to use a _call_via_rX stub to call the function pointer. The
> problem though is that the call to call_via_rx is not a long call, so when ld
> tried to do the location it can't span the jump with the limited
> capabilities (4MB) of a Thumb branch and we end up with a "relocation
> truncated to fit" problem.
>
> It seems to me that this isn't an ld problem since ld can't change a branch
> into a long branch (??can it??).
>
Not directly, but it can make it branch to a reachable trampoline that
can then do the long branch. Indeed, this is what should be done in
general rather than using -mlong-calls, since it just works everywhere
and has no cost when it's not needed.
R.
More information about the Gcc
mailing list