This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: tidy plt entries on x86, ppc
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: binutils at sources dot redhat dot com, Martin Schwidefsky <schwidefsky at de dot ibm dot com>
- Date: Sat, 17 May 2003 21:01:22 +0930
- Subject: Re: tidy plt entries on x86, ppc
- References: <20030517064330.GA957@bubble.sa.bigpond.net.au> <u8znlmf1yj.fsf@gromit.moeb>
On Sat, May 17, 2003 at 09:48:36AM +0200, Andreas Jaeger wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
>
> > Removes some useless .plt entries, and tidies code a little.
> >
> > * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
> > to trim plt entries. Move undefweak non-default visibility test..
> > (allocate_dynrelocs): ..from here.
> > * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't test
> > dynamic_sections_created here. Update comment. Move undefweak
> > non-default visibility test..
> > (allocate_dynrelocs): ..from here. Fix comment.
> > * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
> > to trim plt entries. Move undefweak non-default visibility test..
> > (allocate_dynrelocs): ..from here. Fix comment.
> > * elflink.h (elf_link_output_extsym): Compare ELF_ST_VISIBILITY with
> > STV_DEFAULT rather than comparing with zero.
> > * elflink.c (_bfd_elf_merge_symbol): Likewise.
> > (_bfd_elf_fix_symbol_flags): Likewise. Format comment.
>
> Do we have any tests for these?
No. The motivation for the change was an internal IBM bug report
on powerpc64-linux. We had some c++ code implementing a function
locally, same function provided by libstdc++, and libstdc++.so was
linked against for other functions. The problem was that the local
function call (actually a tail call) was going via a plt call stub
due to the erroneous tests in ppc64_elf_adjust_dynamic_symbol, and
the plt call stub trashed the toc save location on the stack. Boom.
> I assume that these bunch of optimizations that you've done for x86
> and ppc* can also be done for s390 and x86-64?
Yes, should be safe.
> Having some tests as part of binutils would help to us.
True. Care to write one from the description I gave? :)
--
Alan Modra
IBM OzLabs - Linux Technology Centre