[lld-macho] Support static linking of thread-locals
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.) Reviewed By: #lld-macho, compnerd, smeenai Differential Revision: https://reviews.llvm.org/D85080
Loading
Please sign in to comment