[PATCH] D85080: [lld-macho] Support static linking against thread-locals
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 1 15:26:19 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.
Note: What ELF refers to as "TLS", Mach-O seems to refer to as "TLV", i.e.
thread-local variables.
This diff implements support for TLV relocations that reference defined
symbols. On x86_64, TLV relocations are always used with movq opcodes, so for
defined TLVs, we don't need to create a synthetic section to store the
addresses of the symbols -- we can just convert the `movq` to a `leaq`.
One notable quirk of Mach-O's TLVs is that absolute-address relocations
inside TLV-defining sections behave differently -- their addresses are
no longer absolute, but relative to the start of the target section.
(AFAICT, RIP-relative relocations are not allowed in these sections.)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85080
Files:
lld/MachO/Arch/X86_64.cpp
lld/MachO/InputSection.cpp
lld/MachO/InputSection.h
lld/MachO/SyntheticSections.cpp
lld/MachO/Target.h
lld/test/MachO/Inputs/MacOSX.sdk/usr/lib/libSystem.tbd
lld/test/MachO/invalid/bad-tlv-def.s
lld/test/MachO/invalid/bad-tlv-opcode.s
lld/test/MachO/tlv.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85080.282418.patch
Type: text/x-patch
Size: 9360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200801/b931db19/attachment.bin>
More information about the llvm-commits
mailing list