This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM thumb interworking hole?
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: manningc2 at actrix dot gen dot nz
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 10 Jan 2005 11:54:06 +0000
- Subject: Re: ARM thumb interworking hole?
- Organization: GNU
- References: <20050110060158.0ED854265@blood.actrix.co.nz>
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.