[PPC64] Add offset to local entry point when calling functions without plt
authorZaara Syeda <syzaara@ca.ibm.com>
Fri, 27 Apr 2018 15:41:19 +0000 (15:41 +0000)
committerZaara Syeda <syzaara@ca.ibm.com>
Fri, 27 Apr 2018 15:41:19 +0000 (15:41 +0000)
commit82dd99e08ed83f9e4bc9a12e4652d160b1873f30
tree14a9349033b95e3b2843cac2bf7776c17c925671
parent50bf643cfb1a89429095be3ffcdd965f1d670561
[PPC64] Add offset to local entry point when calling functions without plt

PPC64 V2 ABI describes two entry points to a function. The global entry point
sets up the TOC base pointer. When calling a local function, the call should
branch to the local entry point rather than the global entry point.
Section 3.4.1 describes using the 3 most significant bits of the st_other
field to find out how many instructions there are between the local and global
entry point. This patch adds the correct offset required to branch to the local
entry point of a function.

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

llvm-svn: 331046
lld/ELF/InputSection.cpp
lld/test/ELF/Inputs/ppc64-func-global-entry.s [new file with mode: 0644]
lld/test/ELF/Inputs/ppc64-func-local-entry.s [new file with mode: 0644]
lld/test/ELF/ppc64-func-entry-points.s [new file with mode: 0644]