Referencing a function's address on PowerPC64 ELFv2
authorAlan Modra <amodra@gmail.com>
Tue, 25 Mar 2014 04:42:48 +0000 (15:12 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 26 Mar 2014 14:19:38 +0000 (00:49 +1030)
commitf6c7c3e8b742de0a5926e6a2c268f5803062b556
tree1b55c1a26ea275cc79b47a2dd1bb82727047b837
parent0d4d0e772ac36d169d21951c46b0778ae7fa8d53
Referencing a function's address on PowerPC64 ELFv2

ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object.  It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data.  Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.

bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
needed plt entries when taking the address of functions for
abiversion == 0 (ie. unknown) as well as abiversion == 2.
Move opd setup and abiversion checks to..
(ppc64_elf_before_check_relocs): ..here.  Renamed from
ppc64_elf_process_dot_syms.  Set output abiversion from input and
input abiversion from output, if either is not set.
(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
(elf_backend_check_directives): Update.
ld/testsuite/
* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
* ld-powerpc/powerpc.exp: Run new tests.
bfd/ChangeLog
bfd/elf64-ppc.c
ld/testsuite/ChangeLog
ld/testsuite/ld-powerpc/ambiguousv1.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/ambiguousv2.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/funref.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/funv1.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/funv2.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-powerpc/startv1.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/startv2.s [new file with mode: 0644]