[PATCH] D66925: [PPC32] Emit R_PPC_GOT_TPREL16 instead R_PPC_GOT_TPREL16_LO

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 19:09:09 PDT 2019


MaskRay added a comment.

In D66925#1651416 <https://reviews.llvm.org/D66925#1651416>, @jsji wrote:

> The change looks fine to me, as LLVM currently doesn't generate relocation pairs.
>
> However, I think in theory linker should support `R_PPC_GOT_TPREL16_LO` even with PPC32.
>
> As they are well defined according to the PPC 32 Linux ABI here:
>  https://www.polyomino.org.uk/publications/2011/Power-Arch-32-bit-ABI-supp-1.0-Linux.pdf
>
> Table 4-36. TLS Relocation Table
>
> R_PPC_GOT_TPREL16 87 half16* tprelg
>  R_PPC_GOT_TPREL16_LO 88 half16 #lo(tprelg)
>  R_PPC_GOT_TPREL16_HI 89 half16 #hi <https://reviews.llvm.org/tag/calculatorph/>(tprelg)
>  R_PPC_GOT_TPREL16_HA 90 half16 #ha(tprelg)


I think it might be nice to use HA/HI pairs to support >32k TP offsets. I remember on a power64 ELFv2 slide it is mentioned that ELFv2 does "medium model" to solve these problems. Since there is not much interest to fix ELFv1 problems, I'll probably not add more stuff to `lld/ELF/Arch/PPC.cpp`

I'll take that you accepted the patch, and commit it, so that @adalava can quickly file a merge request to release_90.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66925/new/

https://reviews.llvm.org/D66925





More information about the llvm-commits mailing list