2019-06-19 16:40:59 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc -mtriple=riscv32 -relocation-model=pic < %s \
|
|
|
|
; RUN: | FileCheck -check-prefix=RV32-PIC %s
|
|
|
|
; RUN: llc -mtriple=riscv64 -relocation-model=pic < %s \
|
|
|
|
; RUN: | FileCheck -check-prefix=RV64-PIC %s
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RUN: llc -mtriple=riscv32 < %s | FileCheck -check-prefix=RV32-NOPIC %s
|
|
|
|
; RUN: llc -mtriple=riscv64 < %s | FileCheck -check-prefix=RV64-NOPIC %s
|
2019-06-19 16:40:59 +08:00
|
|
|
|
|
|
|
; Check that TLS symbols are lowered correctly based on the specified
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; model. Make sure they're external to avoid them all being optimised to Local
|
|
|
|
; Exec for the executable.
|
2019-06-19 16:40:59 +08:00
|
|
|
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
@unspecified = external thread_local global i32
|
|
|
|
@ld = external thread_local(localdynamic) global i32
|
|
|
|
@ie = external thread_local(initialexec) global i32
|
|
|
|
@le = external thread_local(localexec) global i32
|
2019-06-19 16:40:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
; No model specified
|
|
|
|
|
|
|
|
define i32* @f1() nounwind {
|
|
|
|
; RV32-PIC-LABEL: f1:
|
|
|
|
; RV32-PIC: # %bb.0: # %entry
|
|
|
|
; RV32-PIC-NEXT: addi sp, sp, -16
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV32-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-PIC-NEXT: .LBB0_1: # %entry
|
|
|
|
; RV32-PIC-NEXT: # Label of block must be emitted
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: auipc a0, %tls_gd_pcrel_hi(unspecified)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-PIC-NEXT: addi a0, a0, %pcrel_lo(.LBB0_1)
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: call __tls_get_addr@plt
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV32-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: addi sp, sp, 16
|
|
|
|
; RV32-PIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-PIC-LABEL: f1:
|
|
|
|
; RV64-PIC: # %bb.0: # %entry
|
|
|
|
; RV64-PIC-NEXT: addi sp, sp, -16
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV64-PIC-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-PIC-NEXT: .LBB0_1: # %entry
|
|
|
|
; RV64-PIC-NEXT: # Label of block must be emitted
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: auipc a0, %tls_gd_pcrel_hi(unspecified)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-PIC-NEXT: addi a0, a0, %pcrel_lo(.LBB0_1)
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: call __tls_get_addr@plt
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV64-PIC-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: addi sp, sp, 16
|
|
|
|
; RV64-PIC-NEXT: ret
|
|
|
|
;
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-LABEL: f1:
|
|
|
|
; RV32-NOPIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-NOPIC-NEXT: .LBB0_1: # %entry
|
|
|
|
; RV32-NOPIC-NEXT: # Label of block must be emitted
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-NEXT: auipc a0, %tls_ie_pcrel_hi(unspecified)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-NOPIC-NEXT: lw a0, %pcrel_lo(.LBB0_1)(a0)
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-NEXT: add a0, a0, tp
|
|
|
|
; RV32-NOPIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-NOPIC-LABEL: f1:
|
|
|
|
; RV64-NOPIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-NOPIC-NEXT: .LBB0_1: # %entry
|
|
|
|
; RV64-NOPIC-NEXT: # Label of block must be emitted
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV64-NOPIC-NEXT: auipc a0, %tls_ie_pcrel_hi(unspecified)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-NOPIC-NEXT: ld a0, %pcrel_lo(.LBB0_1)(a0)
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV64-NOPIC-NEXT: add a0, a0, tp
|
|
|
|
; RV64-NOPIC-NEXT: ret
|
2019-06-19 16:40:59 +08:00
|
|
|
entry:
|
|
|
|
ret i32* @unspecified
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; localdynamic specified
|
|
|
|
|
|
|
|
define i32* @f2() nounwind {
|
|
|
|
; RV32-PIC-LABEL: f2:
|
|
|
|
; RV32-PIC: # %bb.0: # %entry
|
|
|
|
; RV32-PIC-NEXT: addi sp, sp, -16
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV32-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-PIC-NEXT: .LBB1_1: # %entry
|
|
|
|
; RV32-PIC-NEXT: # Label of block must be emitted
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: auipc a0, %tls_gd_pcrel_hi(ld)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-PIC-NEXT: addi a0, a0, %pcrel_lo(.LBB1_1)
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: call __tls_get_addr@plt
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV32-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: addi sp, sp, 16
|
|
|
|
; RV32-PIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-PIC-LABEL: f2:
|
|
|
|
; RV64-PIC: # %bb.0: # %entry
|
|
|
|
; RV64-PIC-NEXT: addi sp, sp, -16
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV64-PIC-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-PIC-NEXT: .LBB1_1: # %entry
|
|
|
|
; RV64-PIC-NEXT: # Label of block must be emitted
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: auipc a0, %tls_gd_pcrel_hi(ld)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-PIC-NEXT: addi a0, a0, %pcrel_lo(.LBB1_1)
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: call __tls_get_addr@plt
|
2020-12-10 03:41:19 +08:00
|
|
|
; RV64-PIC-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: addi sp, sp, 16
|
|
|
|
; RV64-PIC-NEXT: ret
|
|
|
|
;
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-LABEL: f2:
|
|
|
|
; RV32-NOPIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-NOPIC-NEXT: .LBB1_1: # %entry
|
|
|
|
; RV32-NOPIC-NEXT: # Label of block must be emitted
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-NEXT: auipc a0, %tls_ie_pcrel_hi(ld)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-NOPIC-NEXT: lw a0, %pcrel_lo(.LBB1_1)(a0)
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-NEXT: add a0, a0, tp
|
|
|
|
; RV32-NOPIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-NOPIC-LABEL: f2:
|
|
|
|
; RV64-NOPIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-NOPIC-NEXT: .LBB1_1: # %entry
|
|
|
|
; RV64-NOPIC-NEXT: # Label of block must be emitted
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV64-NOPIC-NEXT: auipc a0, %tls_ie_pcrel_hi(ld)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-NOPIC-NEXT: ld a0, %pcrel_lo(.LBB1_1)(a0)
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV64-NOPIC-NEXT: add a0, a0, tp
|
|
|
|
; RV64-NOPIC-NEXT: ret
|
2019-06-19 16:40:59 +08:00
|
|
|
entry:
|
|
|
|
ret i32* @ld
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; initialexec specified
|
|
|
|
|
|
|
|
define i32* @f3() nounwind {
|
|
|
|
; RV32-PIC-LABEL: f3:
|
|
|
|
; RV32-PIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-PIC-NEXT: .LBB2_1: # %entry
|
|
|
|
; RV32-PIC-NEXT: # Label of block must be emitted
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: auipc a0, %tls_ie_pcrel_hi(ie)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-PIC-NEXT: lw a0, %pcrel_lo(.LBB2_1)(a0)
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV32-PIC-NEXT: add a0, a0, tp
|
|
|
|
; RV32-PIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-PIC-LABEL: f3:
|
|
|
|
; RV64-PIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-PIC-NEXT: .LBB2_1: # %entry
|
|
|
|
; RV64-PIC-NEXT: # Label of block must be emitted
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: auipc a0, %tls_ie_pcrel_hi(ie)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-PIC-NEXT: ld a0, %pcrel_lo(.LBB2_1)(a0)
|
2019-06-19 16:40:59 +08:00
|
|
|
; RV64-PIC-NEXT: add a0, a0, tp
|
|
|
|
; RV64-PIC-NEXT: ret
|
|
|
|
;
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-LABEL: f3:
|
|
|
|
; RV32-NOPIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-NOPIC-NEXT: .LBB2_1: # %entry
|
|
|
|
; RV32-NOPIC-NEXT: # Label of block must be emitted
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-NEXT: auipc a0, %tls_ie_pcrel_hi(ie)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV32-NOPIC-NEXT: lw a0, %pcrel_lo(.LBB2_1)(a0)
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-NEXT: add a0, a0, tp
|
|
|
|
; RV32-NOPIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-NOPIC-LABEL: f3:
|
|
|
|
; RV64-NOPIC: # %bb.0: # %entry
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-NOPIC-NEXT: .LBB2_1: # %entry
|
|
|
|
; RV64-NOPIC-NEXT: # Label of block must be emitted
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV64-NOPIC-NEXT: auipc a0, %tls_ie_pcrel_hi(ie)
|
2020-07-14 18:15:01 +08:00
|
|
|
; RV64-NOPIC-NEXT: ld a0, %pcrel_lo(.LBB2_1)(a0)
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV64-NOPIC-NEXT: add a0, a0, tp
|
|
|
|
; RV64-NOPIC-NEXT: ret
|
2019-06-19 16:40:59 +08:00
|
|
|
entry:
|
|
|
|
ret i32* @ie
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; localexec specified
|
|
|
|
|
|
|
|
define i32* @f4() nounwind {
|
|
|
|
; RV32-PIC-LABEL: f4:
|
|
|
|
; RV32-PIC: # %bb.0: # %entry
|
|
|
|
; RV32-PIC-NEXT: lui a0, %tprel_hi(le)
|
|
|
|
; RV32-PIC-NEXT: add a0, a0, tp, %tprel_add(le)
|
|
|
|
; RV32-PIC-NEXT: addi a0, a0, %tprel_lo(le)
|
|
|
|
; RV32-PIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-PIC-LABEL: f4:
|
|
|
|
; RV64-PIC: # %bb.0: # %entry
|
|
|
|
; RV64-PIC-NEXT: lui a0, %tprel_hi(le)
|
|
|
|
; RV64-PIC-NEXT: add a0, a0, tp, %tprel_add(le)
|
|
|
|
; RV64-PIC-NEXT: addi a0, a0, %tprel_lo(le)
|
|
|
|
; RV64-PIC-NEXT: ret
|
|
|
|
;
|
[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
2019-12-04 06:04:24 +08:00
|
|
|
; RV32-NOPIC-LABEL: f4:
|
|
|
|
; RV32-NOPIC: # %bb.0: # %entry
|
|
|
|
; RV32-NOPIC-NEXT: lui a0, %tprel_hi(le)
|
|
|
|
; RV32-NOPIC-NEXT: add a0, a0, tp, %tprel_add(le)
|
|
|
|
; RV32-NOPIC-NEXT: addi a0, a0, %tprel_lo(le)
|
|
|
|
; RV32-NOPIC-NEXT: ret
|
|
|
|
;
|
|
|
|
; RV64-NOPIC-LABEL: f4:
|
|
|
|
; RV64-NOPIC: # %bb.0: # %entry
|
|
|
|
; RV64-NOPIC-NEXT: lui a0, %tprel_hi(le)
|
|
|
|
; RV64-NOPIC-NEXT: add a0, a0, tp, %tprel_add(le)
|
|
|
|
; RV64-NOPIC-NEXT: addi a0, a0, %tprel_lo(le)
|
|
|
|
; RV64-NOPIC-NEXT: ret
|
2019-06-19 16:40:59 +08:00
|
|
|
entry:
|
|
|
|
ret i32* @le
|
|
|
|
}
|