[PATCH] D85081: [lld-macho] Support dynamic linking against thread-locals

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 1 15:26:29 PDT 2020


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
int3 requested review of this revision.

References to symbols in dylibs work very similarly regardless of
whether the symbol is a TLV. The main difference is that we have a
separate `__thread_ptrs` section that acts as the GOT for these
thread-locals.

We can identify thread-locals in dylibs by a flag in their export trie
entries, and we cross-check it with the relocations that refer to them
to ensure that we are not using a GOT relocation to reference a
thread-local (or vice versa).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85081

Files:
  lld/MachO/Arch/X86_64.cpp
  lld/MachO/ExportTrie.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/SymbolTable.cpp
  lld/MachO/SymbolTable.h
  lld/MachO/Symbols.h
  lld/MachO/SyntheticSections.cpp
  lld/MachO/SyntheticSections.h
  lld/MachO/Writer.cpp
  lld/test/MachO/invalid/bad-got-to-dylib-tlv-reference.s
  lld/test/MachO/invalid/bad-got-to-tlv-reference.s
  lld/test/MachO/invalid/bad-tlv-relocation.s
  lld/test/MachO/tlv-dylib.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85081.282419.patch
Type: text/x-patch
Size: 16473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200801/0109af81/attachment.bin>


More information about the llvm-commits mailing list