This is the mail archive of the gcc-bugs@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 long calls stubs


Richard Earnshaw wrote:
I have hit an issue with long calls on arm gcc (version 3.0.4 with the
long-calls patch). I see someone else reported this issue on 30 April,
has there been a resolution?

The issue is as follows:

void FnHi() __attribute__((section("high"))) __attribute__((long_call));
void FnLo() __attribute__((section("low"))) __attribute__((long_call));

I can call FnHi() from anywhere within the "low" section, however I
cannot call FnLo() from the "high" section because the _call_via_rX
stub is located in "low", and hence the call to _call_via_rX gets
truncated by the linker.

Is there a way to get gcc to generate the stubs in all sections?
As things stand at the moment: "no".

Even if you could, it would not work, because the linker would just
complain about duplicate definitions of the _call_via_rX symbols.  What
you would need is for gcc to generate branches to functions called
_call_via_rX_from_section_<foo> and then have it generate weak
versions of these functions in every compiled source file that uses
them.

You might be able to achieve a similar effect through judicious use of
partial linking and special linker scrips.  ie you could perform a
partial link of the "high" section code with libgcc.a to resolve all
of the references to __call_via_rX there.  (Making sure that the
script used places the object file containing the _call_via_rX symbols
close to the "high" section).  You could then do a similar partial
link for the "low" section.  The strip out any remaining occurrences of
the _call_via_rX symbols and perform a final link.  It *might* work....

Hmm, I think this is a case where the linker needs to step in and "fix" the problem. In this case it needs to manually insert a small trampoline so that the high call can work correctly. I don't think inventing duplicate call_via_... functions is really the answer. And it needs to do this for each section that can't reach the target section.

R.

By way of a suggestion, how about the _call_via.. functions be made inline? Is there an option to do this? (Could somebody very quickly write a patch to allow this ;-) ??





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