This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ppc64 __attribute__((visibility ("hidden"))) and multiple TOCs
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, binutils at sources dot redhat dot com
- Date: Mon, 25 Jun 2007 23:32:15 +0930
- Subject: Re: ppc64 __attribute__((visibility ("hidden"))) and multiple TOCs
- References: <20070625110601.GQ7012@devserv.devel.redhat.com>
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