This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: ppc64 __attribute__((visibility ("hidden"))) and multiple TOCs


On Mon, Jun 25, 2007 at 07:06:01AM -0400, Jakub Jelinek wrote:
> Hi!
> 
> extern void bar (void) __attribute__((visibility ("hidden")));
> void foo (void)
> {
>   bar ();
>   bar ();
> }
> compiled on ppc64-linux with -O2 -m64 -mminimal-toc
> leads to bl bar without nop in the following instruction
> and to sibling call.
> Now, when this together with bar's definition is linked
> into a big binary and foo and bar need to have different TOCs,
> ld issues error:
> sibling call optimization to `bar' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `foo' extern

Ouch.  

> Shouldn't -mminimal-toc also forbid omitting nops if
> the target call isn't defined in the same file and forbid
> sibcalls to such functions?  Or do we need another switch?
> In this case -mminimal-toc, nor -fno-optimize-sibling-calls
> helps ATM, only removing the hidden visibility.

A TARGET_BINDS_LOCAL_P for powerpc64-linux is the easiest way to fix
this.  It should return false for any function not in the same file,
and *not* be controlled by -mminimal-toc.  -mminimal-toc is actually
orthogonal to the linker's toc splitting at file boundaries.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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