HomePhabricator

[PowerPC] Add support for R_PPC64_GOT_TPREL_PCREL34 used in TLS Initial Exec

Authored by stefanp on Sep 18 2020, 11:08 AM.

Description

[PowerPC] Add support for R_PPC64_GOT_TPREL_PCREL34 used in TLS Initial Exec

Add Thread Local Storage Initial Exec support to LLD.

This patch adds the computation for the relocations as well as the relaxation from Initial Exec to Local Exec.

Initial Exec:

pld r9, x@got@tprel@pcrel
add r9, r9, x@tls@pcrel

or

pld r9, x@got@tprel@pcrel
lbzx r10, r9, x@tls@pcrel

Note that @tls@pcrel is actually encoded as R_PPC64_TLS with a one byte displacement.

For the above examples relaxing Intitial Exec to Local Exec:

paddi r9, r9, x@tprel
nop

or

paddi r9, r13, x@tprel
lbz r10, 0(r9)

Reviewed By: nemanjai, MaskRay, #powerpc

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

Details