[PATCH] D95121: [lld-macho][NFC] refactor relocation handling
Greg McGary via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 31 19:00:55 PST 2021
gkm marked 2 inline comments as done.
gkm added a comment.
I also completed the `TODO(gkm): hoist into target-independent code driven by RelocAttrBits` refactors for `prepareSymbolRelocation()` and `resolveSymbolVA()`
================
Comment at: lld/MachO/Target.h:50-51
+ GOT = 1 << 11, // Has a Global Offset Table slot
+ TLV = 1 << 12, // Has a Thread-Local Variable slot
+ TLS = 1 << 13, // Can reside in Thread-Local Storage
+ MORPH = 1 << 14, // morph instruction: load into add
----------------
int3 wrote:
> gkm wrote:
> > int3 wrote:
> > > I think ld64 (and other bits of macOS source) use "TLV" in place of "TLS". Pointers to TLVs are abbreviated as `TLVP`s.
> > That's a real distinction, and apparently needs more commentary to avoid confusion:
> > TLV = //Thread-Local Variable// and pertains to the datum and its symbol.
> > TLS = //Thread-Local Storage// and pertains to the section that contains the TLVs.
> I understood the distinction... I'm saying that `TLVP` seems like a more appropriate name for the former and `TLV` for the latter. In particular, in the `SectionType` enum, we have
>
> ```
> /// S_THREAD_LOCAL_VARIABLES - Section with thread local variable
> /// structure data.
> S_THREAD_LOCAL_VARIABLES = 0x13u,
> /// S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread
> /// local structures.
> S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14u,
> ```
>
> Based on the above, it seems fitting to me that a reloc which can be present in a S_THREAD_LOCAL_VARIABLES section has attribute TLV. And similarly TLVP seems like a fitting name for a reloc which can point to an address in a S_THREAD_LOCAL_VARIABLES section.
>
> I'm aware that "TLS" is commonly used in the sense that you are describing, but from what I can tell neither ld64 nor dyld use that abbreviation, so it would be nice to hew to that.
Very good. I realized we only need one bit, which I named `TLV`. Thread-local Variable Pointer relocs are `TLV|LOAD`, and Thread-local Variable relocs are `TLV` (no `LOAD`).
BTW, `LOAD` is a new name for what I had been calling `MORPH`, and then `RELAX`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95121/new/
https://reviews.llvm.org/D95121
More information about the llvm-commits
mailing list