[PATCH] D57673: [PPC64] Set the number of relocations processed for R_PPC64_TLS[GL]D to 2

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 08:41:40 PST 2019


sfertile added a comment.

In D57673#1382845 <https://reviews.llvm.org/D57673#1382845>, @MaskRay wrote:

> If this is allowed. Is there any restriction on the TLS code sequence? e.g. Is it allowed to omit `R_PPC64_GOT_TLSGD16_HA`?


In general other relocations are allowed to show up in-between the TLS relocations.  You can omit the `R_PPC64_GOT_TLSGD16_HA` relocation and use a `R_PPC64_GOT_TLSGD16` instead of the `_LO`. Clang and xlc don't do that but gcc will with small code model (clang not doing it is likely a bug, xlc doesn't support small code model for V2 abi).

In D57673#1382845 <https://reviews.llvm.org/D57673#1382845>, @MaskRay wrote:

> or swap the order of some sequences?


I hadn't considered this before. I don't belive there is an abi guarantee that the HA/HI comes before the low so something like:

  addi 3, 2, i at got@tlsgd at l
  addis 3, 3, i at got@tlsgd at ha
  bl __tls_get_addr(i at tlsgd)
  nop

Is potentially valid, while the tls optimizations we produce in lld are likely invlaid :(. I'll have to look into this a bit deeper.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D57673





More information about the llvm-commits mailing list