[PATCH] D93331: [ELF] Reject local-exec TLS relocations for -shared
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 15 12:20:31 PST 2020
MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson, psmith.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, pzheng, pengfei, s.egerton, lenary, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, kbarton, kristof.beyls, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
For x86-64, D33100 <https://reviews.llvm.org/D33100> added a diagnostic for local-exec TLS relocations referencing a preemptible symbol.
This patch generalizes it to non-preemptible symbols (see `-Bsymbolic` in `tls.s`)
on all targets.
Local-exec TLS relocations resolve to offsets relative to a fixed point within
the static TLS block, which are only meaningful for the executable.
With this change, `clang -fpic -shared a.c` on the following example will be flagged.
static __attribute__((tls_model("local-exec"))) __thread long TlsVar = 42;
long bump() { return ++TlsVar; }
Note, in GNU ld, at least arm, riscv and x86's ports have the similar
diagnostics, but aarch64 and ppc64 do not error.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93331
Files:
lld/ELF/Relocations.cpp
lld/test/ELF/Inputs/i386-static-tls-model4.s
lld/test/ELF/aarch64-tls-le.s
lld/test/ELF/arm-tls-le32.s
lld/test/ELF/i386-static-tls-model.s
lld/test/ELF/i386-tls-le.s
lld/test/ELF/i386-zrel-zrela.s
lld/test/ELF/mips-tls-hilo.s
lld/test/ELF/ppc64-local-exec-tls.s
lld/test/ELF/riscv-tls-le.s
lld/test/ELF/tls.s
lld/test/ELF/x86-64-reloc-tpoff32-fpic.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93331.311992.patch
Type: text/x-patch
Size: 12775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201215/b0490677/attachment.bin>
More information about the llvm-commits
mailing list