[all-commits] [llvm/llvm-project] 791228: [LLD][PowerPC] Add support for R_PPC64_GOT_TLSGD_P...
stefanp-ibm via All-commits
all-commits at lists.llvm.org
Thu Oct 1 11:01:16 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 79122868f9a3909cfd94d51e9bfe960917a1be05
https://github.com/llvm/llvm-project/commit/79122868f9a3909cfd94d51e9bfe960917a1be05
Author: Stefan Pintilie <stefanp at ca.ibm.com>
Date: 2020-10-01 (Thu, 01 Oct 2020)
Changed paths:
M lld/ELF/Arch/PPC64.cpp
M lld/ELF/Relocations.cpp
A lld/test/ELF/ppc64-tls-pcrel-gd.s
Log Message:
-----------
[LLD][PowerPC] Add support for R_PPC64_GOT_TLSGD_PCREL34 used in TLS General Dynamic
Add Thread Local Storage support for the 34 bit relocation R_PPC64_GOT_TLSGD_PCREL34 used in General Dynamic.
The compiler will produce code that looks like:
```
pla r3, x at got@tlsgd at pcrel R_PPC64_GOT_TLSGD_PCREL34
bl __tls_get_addr at notoc(x at tlsgd) R_PPC64_TLSGD
R_PPC64_REL24_NOTOC
```
LLD should be able to correctly compute the relocation for R_PPC64_GOT_TLSGD_PCREL34 as well as do the following two relaxations where possible:
General Dynamic to Local Exec:
```
paddi r3, r13, x at tprel
nop
```
and General Dynamic to Initial Exec:
```
pld r3, x at got@tprel at pcrel
add r3, r3, r13
```
Note:
This patch adds support for the PC Relative (no TOC) version of General Dynamic on top of the existing support for the TOC version of General Dynamic.
The ABI does not provide any way to tell by looking only at the relocation `R_PPC64_TLSGD` when it is being used in a TOC instruction sequence or and when it is being used in a no TOC sequence. The TOC sequence should always be 4 byte aligned. This patch adds one to the offset of the relocation when it is being used in a no TOC sequence. In this way LLD can tell by looking at the alignment of the offset of `R_PPC64_TLSGD` whether or not it is being used as part of a TOC or no TOC sequence.
Reviewed By: NeHuang, sfertile, MaskRay
Differential Revision: https://reviews.llvm.org/D87318
More information about the All-commits
mailing list