Skip to content

Commit 87adafc

Browse files
committed
[LoongArch] Pre-commit test for fixing tls-le symbol type
The symbol type of tls-le must be `TLS`, it was incorrectly set as `NOTYPE`. A later commit will fix it.
1 parent c177dbe commit 87adafc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; RUN: llc --mtriple=loongarch32 --filetype=obj %s -o %t-la32
2+
; RUN: llvm-readelf -s %t-la32 | FileCheck %s --check-prefix=LA32
3+
4+
; RUN: llc --mtriple=loongarch64 --filetype=obj %s -o %t-la64
5+
; RUN: llvm-readelf -s %t-la64 | FileCheck %s --check-prefix=LA64
6+
7+
; LA32: Symbol table '.symtab' contains [[#]] entries:
8+
; LA32-NEXT: Num: Value Size Type Bind Vis Ndx Name
9+
; LA32: 00000000 0 NOTYPE GLOBAL DEFAULT UND tls_sym
10+
11+
; LA64: Symbol table '.symtab' contains [[#]] entries:
12+
; LA64-NEXT: Num: Value Size Type Bind Vis Ndx Name
13+
; LA64: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND tls_sym
14+
15+
@tls_sym = external thread_local(localexec) global i32
16+
17+
define dso_local signext i32 @test_tlsle() nounwind {
18+
entry:
19+
%0 = call ptr @llvm.threadlocal.address.p0(ptr @tls_sym)
20+
%1 = load i32, ptr %0
21+
ret i32 %1
22+
}
23+
24+
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull)

0 commit comments

Comments
 (0)