This is the mail archive of the 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] Don't shorten long calls to different sections

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.

>   - Sibling calls to B are shortened without checking A's section.
>   - Non-sibling calls to B are shortened for PIC, even if B can
>     be overridden.
> The optimisation also seems somewhat limited:
>   (1) B must be defined before A.

The code was written before unit-at-a-time was added; it's never been

>   (2) Sibcalls to B are never shortened for PIC, even if the definition
>       of B cannot be overridden.
>   (3) Calls are not shortened if A and B are in the same non-default section.
> Tested on arm-eabi and arm-wrs-vxworks (to be submitted in a sec).
> OK to install?

Yes, this is OK.  Thanks for looking into this, that's another item on
my todo list that I can remove... :-)


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