This is the mail archive of the binutils@sources.redhat.com 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: tidy plt entries on x86, ppc


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


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