File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 29
29
# RUN: ld.lld -e 0 -z now a.32 .o c.32 .so -o a.32 .ie
30
30
# RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.32 .ie | FileCheck %s --check-prefix=IE32
31
31
32
+ # RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64 .o
33
+ # RUN: not ld.lld -shared -soname=d.64 .so -o d.64 .so d.64 .o 2 >&1 | FileCheck %s --check-prefix=BADTLSLABEL
34
+
35
+ # RUN: llvm-mc -triple=riscv32 -filetype=obj d.s -o d.32 .o --defsym ELF32=1
36
+ # RUN: not ld.lld -shared -soname=d.32 .so -o d.32 .so d.32 .o 2 >&1 | FileCheck %s --check-prefix=BADTLSLABEL
37
+
32
38
# GD64-RELA: .rela.dyn {
33
39
# GD64-RELA-NEXT: 0x2408 R_RISCV_TLSDESC - 0x7FF
34
40
# GD64-RELA-NEXT: 0x23E8 R_RISCV_TLSDESC a 0x0
150
156
# IE32-NEXT: lw a0 , 0x80(a0 )
151
157
# IE32-NEXT: add a0 , a0 , tp
152
158
159
+ ## FIXME This should not pass, but the code MC layer needs a fix to prevent this.
160
+ # BADTLSLABEL: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an SHF_TLS section
161
+
153
162
#--- a.s
154
163
.macro load dst, src
155
164
.ifdef ELF32
192
201
.tbss
193
202
.globl c
194
203
c: .zero 4
204
+
205
+ #--- d.s
206
+ .macro load dst, src
207
+ .ifdef ELF32
208
+ lw \dst, \src
209
+ .else
210
+ ld \dst, \src
211
+ .endif
212
+ .endm
213
+
214
+ .Ltlsdesc_hi0:
215
+ auipc a0 , %tlsdesc_hi(foo)
216
+ load a1 , %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0 )
217
+ addi a0 , a0 , %tlsdesc_add_lo(.Ltlsdesc_hi0)
218
+ jalr t0, 0 (a1 ), %tlsdesc_call(.Ltlsdesc_hi0)
219
+ add a1 , a0 , tp
Original file line number Diff line number Diff line change
1
+ ;; The test in this file do not appear in tls-models.ll because
2
+ ;; they are not auto-generated.
3
+ ; RUN: llc -mtriple=riscv64 -relocation-model=pic -enable-tlsdesc < %s \
4
+ ; RUN: | llvm-mc -triple=riscv64 -filetype=obj -o - \
5
+ ; RUN: | llvm-readelf --symbols - \
6
+ ; RUN: | FileCheck %s
7
+
8
+ ; RUN: llc -mtriple=riscv32 -relocation-model=pic -enable-tlsdesc < %s \
9
+ ; RUN: | llvm-mc -triple=riscv32 -filetype=obj -o - \
10
+ ; RUN: | llvm-readelf --symbols - \
11
+ ; RUN: | FileCheck %s
12
+
13
+ ; Check that TLS symbols are lowered correctly based on the specified
14
+ ; model. Make sure they're external to avoid them all being optimised to Local
15
+ ; Exec for the executable.
16
+
17
+ @unspecified = external thread_local global i32
18
+
19
+ define ptr @f1 () nounwind {
20
+ entry:
21
+ ret ptr @unspecified
22
+ ; CHECK: Symbol table '.symtab' contains 7 entries:
23
+ ; CHECK: TLS {{.*}} unspecified
24
+ }
You can’t perform that action at this time.
0 commit comments