PowerPC64 undefined weak visibility vs GOT optimisation
authorAlan Modra <amodra@gmail.com>
Tue, 2 Mar 2021 10:52:31 +0000 (21:22 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 2 Mar 2021 11:17:42 +0000 (21:47 +1030)
commitf5b9c288a3057f0f04e74f00fdb0e79d171d54a8
tree8286125cbea609ffb437fcd0155dbc6b913336a2
parentec11fcffc00ed02eed7b18b312a1af857f5a8caa
PowerPC64 undefined weak visibility vs GOT optimisation

Undefined weak symbols with non-default visibility are seen as local
by SYMBOL_REFERENCES_LOCAL.  This stops a got indirect to relative
optimisation for them, so that pies and dlls don't get non-zero values
when loading somewhere other than the address they are linked at
(which always happens).  The optimisation could be allowed for pdes,
but I thought it best not to allow it there too.

bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): Don't optimise got
indirect to pc-relative or toc-relative for undefined symbols.
ld/
* testsuite/ld-powerpc/weak1.d,
* testsuite/ld-powerpc/weak1.r,
* testsuite/ld-powerpc/weak1.s,
* testsuite/ld-powerpc/weak1so.d,
* testsuite/ld-powerpc/weak1so.r: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
bfd/ChangeLog
bfd/elf64-ppc.c
ld/ChangeLog
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-powerpc/weak1.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/weak1.r [new file with mode: 0644]
ld/testsuite/ld-powerpc/weak1.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/weak1so.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/weak1so.r [new file with mode: 0644]