2 # RUN: rm -rf %t && split-file %s %t
4 # RUN: llvm-mc --filetype=obj --triple=loongarch32 %t/32.s -o %t/32.o
5 # RUN: llvm-mc --filetype=obj --triple=loongarch64 %t/64.s -o %t/64.o
8 # RUN: ld.lld -shared %t/32.o -o %t/32.so
9 # RUN: llvm-readobj -r -d %t/32.so | FileCheck --check-prefix=IE32-REL %s
10 # RUN: llvm-objdump -d --no-show-raw-insn %t/32.so | FileCheck --check-prefixes=IE32 %s
13 # RUN: ld.lld %t/32.o -o %t/32
14 # RUN: llvm-readelf -r %t/32 | FileCheck --check-prefix=NOREL %s
15 # RUN: llvm-readelf -x .got %t/32 | FileCheck --check-prefix=LE32-GOT %s
16 # RUN: llvm-objdump -d --no-show-raw-insn %t/32 | FileCheck --check-prefixes=LE32 %s
19 # RUN: ld.lld -shared %t/64.o -o %t/64.so
20 # RUN: llvm-readobj -r -d %t/64.so | FileCheck --check-prefix=IE64-REL %s
21 # RUN: llvm-objdump -d --no-show-raw-insn %t/64.so | FileCheck --check-prefixes=IE64 %s
24 # RUN: ld.lld %t/64.o -o %t/64
25 # RUN: llvm-readelf -r %t/64 | FileCheck --check-prefix=NOREL %s
26 # RUN: llvm-readelf -x .got %t/64 | FileCheck --check-prefix=LE64-GOT %s
27 # RUN: llvm-objdump -d --no-show-raw-insn %t/64 | FileCheck --check-prefixes=LE64 %s
29 # IE32-REL: FLAGS STATIC_TLS
30 # IE32-REL: .rela.dyn {
31 # IE32-REL-NEXT: 0x20218 R_LARCH_TLS_TPREL32 - 0xC
32 # IE32-REL-NEXT: 0x20214 R_LARCH_TLS_TPREL32 a 0x0
35 # IE64-REL: FLAGS STATIC_TLS
36 # IE64-REL: .rela.dyn {
37 # IE64-REL-NEXT: 0x20370 R_LARCH_TLS_TPREL64 - 0xC
38 # IE64-REL-NEXT: 0x20368 R_LARCH_TLS_TPREL64 a 0x0
42 ## &.got[0] - . = 0x20214 - 0x101a4: 0x10 pages, page offset 0x214
43 ## &.got[1] - . = 0x20218 - 0x101b0: 0x10 pages, page offset 0x218
44 # IE32: 101a4: pcalau12i $a4, 16
45 # IE32-NEXT: ld.w $a4, $a4, 532
46 # IE32-NEXT: add.w $a4, $a4, $tp
47 # IE32-NEXT: 101b0: pcalau12i $a5, 16
48 # IE32-NEXT: ld.w $a5, $a5, 536
49 # IE32-NEXT: add.w $a5, $a5, $tp
52 ## &.got[0] - . = 0x20368 - 0x102a0: 0x10 pages, page offset 0x368
53 ## &.got[1] - . = 0x20370 - 0x102ac: 0x10 pages, page offset 0x370
54 # IE64: 102a0: pcalau12i $a4, 16
55 # IE64-NEXT: ld.d $a4, $a4, 872
56 # IE64-NEXT: add.d $a4, $a4, $tp
57 # IE64-NEXT: 102ac: pcalau12i $a5, 16
58 # IE64-NEXT: ld.d $a5, $a5, 880
59 # IE64-NEXT: add.d $a5, $a5, $tp
61 # NOREL: no relocations
63 # a@tprel = st_value(a) = 0x8
64 # b@tprel = st_value(a) = 0xc
65 # LE32-GOT: section '.got':
66 # LE32-GOT-NEXT: 0x0003012c 08000000 0c000000
67 # LE64-GOT: section '.got':
68 # LE64-GOT-NEXT: 0x000301e0 08000000 00000000 0c000000 00000000
71 ## &.got[0] - . = 0x3012c - 0x20114: 0x10 pages, page offset 0x12c
72 ## &.got[1] - . = 0x30130 - 0x20120: 0x10 pages, page offset 0x130
73 # LE32: 20114: pcalau12i $a4, 16
74 # LE32-NEXT: ld.w $a4, $a4, 300
75 # LE32-NEXT: add.w $a4, $a4, $tp
76 # LE32-NEXT: 20120: pcalau12i $a5, 16
77 # LE32-NEXT: ld.w $a5, $a5, 304
78 # LE32-NEXT: add.w $a5, $a5, $tp
81 ## &.got[0] - . = 0x301e0 - 0x201c8: 0x10 pages, page offset 0x1e0
82 ## &.got[1] - . = 0x301e8 - 0x201d4: 0x10 pages, page offset 0x1e8
83 # LE64: 201c8: pcalau12i $a4, 16
84 # LE64-NEXT: ld.d $a4, $a4, 480
85 # LE64-NEXT: add.d $a4, $a4, $tp
86 # LE64-NEXT: 201d4: pcalau12i $a5, 16
87 # LE64-NEXT: ld.d $a5, $a5, 488
88 # LE64-NEXT: add.d $a5, $a5, $tp
96 .section .tbss,"awT",@nobits
109 .section .tbss,"awT",@nobits