[all-commits] [llvm/llvm-project] da7b12: [RISCV] Don't force Local Exec TLS for non-PIC

James Clarke via All-commits all-commits at lists.llvm.org
Tue Dec 3 14:05:06 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: da7b129b1b52bdc52b02b546b75f90fad07f6d3a
      https://github.com/llvm/llvm-project/commit/da7b129b1b52bdc52b02b546b75f90fad07f6d3a
  Author: James Clarke <jrtc27 at jrtc27.com>
  Date:   2019-12-03 (Tue, 03 Dec 2019)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/tls-models.ll

  Log Message:
  -----------
  [RISCV] Don't force Local Exec TLS for non-PIC

Summary:
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, 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).

Reviewers: asb, MaskRay

Reviewed By: MaskRay

Subscribers: emaste, krytarowski, hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, llvm-commits, bsdjhb

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70649




More information about the All-commits mailing list