This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB 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]

[binutils-gdb] PowerPC dynamic relocations


*** TEST RESULTS FOR COMMIT f0158f44168c29338e0b4424c69589f79bf58b19 ***

Author: Alan Modra <amodra@gmail.com>
Branch: master
Commit: f0158f44168c29338e0b4424c69589f79bf58b19

PowerPC dynamic relocations

This patch fixes a number of issues with powerpc dynamic relocations.

1) Both ppc and ppc64 were emitting more dynamic symbols and
relocations than necessary, due to not supporting static linker
resolution of tls_index entries for __tls_get_addr_opt.  This meant
that any @got@tlsgd or @got@tlsld reloc needed to make their symbols
dynamic and generate dptmod and dtprel relocs for the dynamic linker.
That would have been passable, but what happened was that practically
all @got relocations resulted in their symbols being made dynamic and
dynamic relocations emitted against the GOT entries.  (Mostly visible
on ppc32 executables since ppc64 gcc really only uses @got style
relocs for TLS.)

2) The PowerOpen syntax was not supported with __tls_get_addr_opt.
DTPMOD/DTPREL relocs on tls_index TOC entries did not use the trick of
forcing dynamic symbols and relocations so those entries always
resulted in the full __tls_get_addr processing.  gcc doesn't use the
PowerOpen syntax for TLS, and normally such code would be optimized to
TLS IE or LE so the impact of missing this support was minimal.

3) In an executable, relocations against GNU indirect functions always
used the value of their PLT stub.   While this is correct, it is
better in some cases to use a dynamic relocation.  An extra dynamic
relocation can mean that calls via function pointers need not bounce
through the PLT stub at runtime.

The patch also tidies the PLT handling code in ppc32
allocate_dynrelocs.  Allocating PLT entries after other dynamic relocs
allows the PLT loop to omit special handling for undefined weak
symbols, and that in turn allows the loop to be simplified.

bfd/
	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
	where dynamic relocs are preferable.  Allow ifunc too.
	(ensure_undefweak_dynamic): New function.
	(allocate_dynrelocs): Use it here.  Move plt handling last and
	don't make symbols dynamic, simplifying loop.  Only make undef
	weak symbols with GOT entries dynamic.  Correct condition
	for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
	comments.  Remove goto.
	(ppc_elf_relocate_section): Correct test for using dynamic
	symbol on GOT relocs.  Rearrange test for emitting GOT relocs
	to suit.  Set up explicit tls_index entries and implicit GOT
	tls_index entries resolvable at link time for
	__tls_get_addr_opt.  Simplify test to clear mem for prelink.
	* elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
	(ensure_undefweak_dynamic): New function.
	(allocate_dynrelocs): Use it here.  Only make undef weak symbols
	with GOT entries dynamic.  Remove unnecessary test of
	WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
	(ppc64_elf_relocate_section): Correct test for using dynamic
	symbol on GOT relocs.  Rearrange test for emitting GOT relocs
	to suit.  Set up explicit tls_index entries and implicit GOT
	tls_index entries resolvable at link time for __tls_get_addr_opt.
	Simplify expression to clear mem for prelink.
ld/
	* testsuite/ld-powerpc/tlsexe.r: Update for fewer dynamic relocs
	and symbols.
	* testsuite/ld-powerpc/tlsexe.d: Likewise.
	* testsuite/ld-powerpc/tlsexe.g: Likewise.


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