[PPC64] Long branch thunks.
authorSean Fertile <sfertile@ca.ibm.com>
Wed, 14 Nov 2018 17:56:43 +0000 (17:56 +0000)
committerSean Fertile <sfertile@ca.ibm.com>
Wed, 14 Nov 2018 17:56:43 +0000 (17:56 +0000)
commit614dc11ca8bc8cb3296dbcc4712d98408d438f45
treeab9540f5eb74aac3486b09cb0f3b42e40081e454
parent36eef925c0f1b92dc82d232c009debd30e08fc7e
[PPC64] Long branch thunks.

On PowerPC64, when a function call offset is too large to encode in a call
instruction the address is stored in a table in the data segment. A thunk is
used to load the branch target address from the table relative to the
TOC-pointer and indirectly branch to the callee. When linking position-dependent
code the addresses are stored directly in the table, for position-independent
code the table is allocated and filled in at load time by the dynamic linker.

For position-independent code the branch targets could have gone in the .got.plt
but using the .branch_lt section for both position dependent and position
independent binaries keeps it consitent and helps keep this PPC64 specific logic
seperated from the target-independent code handling the .got.plt.

Differential Revision: https://reviews.llvm.org/D53408

llvm-svn: 346877
13 files changed:
lld/ELF/Arch/PPC64.cpp
lld/ELF/Relocations.cpp
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Thunks.cpp
lld/ELF/Writer.cpp
lld/test/ELF/basic-ppc64.s
lld/test/ELF/basic64be.s
lld/test/ELF/ppc64-call-reach.s
lld/test/ELF/ppc64-long-branch.s [new file with mode: 0644]
lld/test/ELF/ppc64-shared-long_branch.s [new file with mode: 0644]