diff options
author | Fangrui Song <i@maskray.me> | 2020-01-24 17:49:59 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2020-01-25 17:57:26 -0800 |
commit | 6f8ad14521ec2983f2398bae32a717842e2cf313 (patch) | |
tree | 28af04b28bea394c5e2b24d835dc92f9f104f9b4 /lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp | |
parent | c21e178bf22b6b46f087e6aab02a34d11dd98432 (diff) | |
download | bcm5719-llvm-6f8ad14521ec2983f2398bae32a717842e2cf313.tar.gz bcm5719-llvm-6f8ad14521ec2983f2398bae32a717842e2cf313.zip |
[ELF][PPC32] Support canonical PLT
-fno-pie produces a pair of non-GOT-non-PLT relocations R_PPC_ADDR16_{HA,LO} (R_ABS) referencing external
functions.
```
lis 3, func@ha
la 3, func@l(3)
```
In a -no-pie/-pie link, if func is not defined in the executable, a canonical PLT entry (st_value>0, st_shndx=0) will be needed.
References to func in shared objects will be resolved to this address.
-fno-pie -pie should fail with "can't create dynamic relocation ... against ...", so we just need to think about -no-pie.
On x86, the PLT entry passes the JMP_SLOT offset to the rtld PLT resolver.
On x86-64: the PLT entry passes the JUMP_SLOT index to the rtld PLT resolver.
On ARM/AArch64: the PLT entry passes &.got.plt[n]. The PLT header passes &.got.plt[fixed-index]. The rtld PLT resolver can compute the JUMP_SLOT index from the two addresses.
For these targets, the canonical PLT entry can just reuse the regular PLT entry (in PltSection).
On PPC32: PltSection (.glink) consists of `b PLTresolve` instructions and `PLTresolve`. The rtld PLT resolver depends on r11 having been set up to the .plt (GotPltSection) entry.
On PPC64 ELFv2: PltSection (.glink) consists of `__glink_PLTresolve` and `bl __glink_PLTresolve`. The rtld PLT resolver depends on r12 having been set up to the .plt (GotPltSection) entry.
We cannot reuse a `b PLTresolve`/`bl __glink_PLTresolve` in PltSection as a canonical PLT entry. PPC64 ELFv2 avoids the problem by using TOC for any external reference, even in non-pic code, so the canonical PLT entry scenario should not happen in the first place.
For PPC32, we have to create a PLT call stub as the canonical PLT entry. The code sequence sets up r11.
Reviewed By: Bdragon28
Differential Revision: https://reviews.llvm.org/D73399
(cherry picked from commit 837e8a9c0cd097034e023dfba146d17ce132998c)
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp')
0 files changed, 0 insertions, 0 deletions