This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ARM] Don't shorten long calls to different sections
On Fri, 2007-05-25 at 09:49 +0100, Richard Sandiford wrote:
> Richard Earnshaw <rearnsha@arm.com> writes:
> > On Thu, 2007-05-24 at 21:25 +0100, Richard Sandiford wrote:
> >> If function A calls long_call function B, the ARM port tries to
> >> convert the call into a short call if it thinks B is in range.
> >> There is some code to prevent this optimisation when A and B
> >> are in different sections, but it isn't complete:
> >>
> >> - Non-sibling and sibling calls to B are shortened when B is weak.
> >> (The strong definition might not be in range.)
> >>
> >
> > ??? I was under the impression that the opposite was true for
> > non-sibling calls: namely that calls to a weak B were never shortened,
> > even if the user hadn't requested long calls. Eg:
> >
> > int y;
> > int __attribute__((weak)) x () { return y; }
> > int f() { return x(); }
> >
> > generates an indirect call when compiled with -O.
>
> Sorry, yes, I misread the testcase FAILs from the pre-patch compiler.
> It was only sibling calls to long_calls that were affected. I.e.
>
> int y;
> int __attribute__((weak, long_call)) x () { return y; }
> int f() { return x(); }
>
> would use a short call at -O2.
>
> Do you want the retain the behaviour that all calls to weak functions
> are assumed long? Or is it OK to treat them simply as calls to
> externally-defined functions, as the patch does? (I realise you
> said OK, just thought I'd better clarify.)
I consider the existing behaviour a bug. So no need to change your
code.
R.