[PATCH] D109293: [JITLink][WIP] Add initial native TLS support to ELFNix platform

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 6 06:00:44 PDT 2021


lhames added a comment.

In D109293#2984957 <https://reviews.llvm.org/D109293#2984957>, @MoritzS wrote:

> The ELF TLS spec actually describes using the GOT for that.

I need to find some time to read the ELF TLS spec. Unless use of the GOT is required (which seems unlikely) I'd rather put these in their own section. In the unlikely event that they really need to be mixed with GOT entries we should spin out an ELF-specific GOT pass to handle this.

> I think the practical reason for that is that a TLSGD relocation is 32-bit PC-relative, so using an address of the GOT will guarantee that the 32 bit offset can represent the address.

We can count on JITLink (and the memory manager) to do this for us. It's designed to address RuntimeDyld::MemoryManager's shortcomings in that regard.

> In general I would suggest not trying to resolve a TLSGD/LD relocation at all but instead converting it to a GOTTPOFF relocation. Then, no runtime function to implement __tls_get_addr is needed.

Is that compatible with adding extra code at runtime? I suspect we'll need to go the other way: convert things to function calls by default, but make it possible to use direct models where they're safe. That's speculation having not read the TLS spec though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109293



More information about the llvm-commits mailing list