[PATCH] D70649: [RISCV] Don't force Local Exec TLS for non-PIC

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 15:26:53 PST 2019


jrtc27 created this revision.
jrtc27 added reviewers: asb, MaskRay.
Herald added subscribers: llvm-commits, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, krytarowski, emaste.
Herald added a project: LLVM.

Forcing Local Exec TLS requires the use of copy relocations. Copy
relocations need special handling in the runtime linker when being used
against TLS symbols, which is present in glibc, but not in FreeBSD nor
musl, and so cannot be relied upon. Moreover, copy relocations are a
hack that embed the size of an object in the ABI when it otherwise
wouldn't be, and break protected symbols (which are expected to be DSO
local), whilst also wasting space, thus they should be avoided whenever
possible. As discussed in D70398 <https://reviews.llvm.org/D70398>, RISC-V should move away from forcing
Local Exec, and instead use Initial Exec like other targets, with
possible linker relaxation to follow. The RISC-V GCC maintainers also
intend to adopt this more-conventional behaviour (see
https://github.com/riscv/riscv-elf-psabi-doc/issues/122).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70649

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/tls-models.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70649.230826.patch
Type: text/x-patch
Size: 5780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191124/2319a4cd/attachment.bin>


More information about the llvm-commits mailing list