2 # RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o
4 # RUN: ld.lld -shared %t.o -o %t.so
5 # RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=IE-REL %s
6 # RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
7 # RUN: llvm-objdump --section .data --full-contents %t.so | FileCheck --check-prefix=IE-DATA %s
9 # RUN: ld.lld %t.o -o %t
10 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
11 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
12 # RUN: llvm-objdump --section .data --full-contents %t | FileCheck --check-prefix=LE-DATA %s
13 # RUN: llvm-objdump --section .got --full-contents %t | FileCheck --check-prefix=LE-GOT %s
15 ## With -pie we still have the R_390_RELATIVE for the data element, but all GOT
16 ## entries should be fully resolved without any remaining R_390_TLS_TPOFF.
17 # RUN: ld.lld -pie %t.o -o %t.pie
18 # RUN: llvm-readelf -r %t.pie | FileCheck --check-prefix=PIE-REL %s
19 # RUN: llvm-objdump -d --no-show-raw-insn %t.pie | FileCheck --check-prefix=PIE %s
20 # RUN: llvm-objdump --section .data --full-contents %t.pie | FileCheck --check-prefix=PIE-DATA %s
21 # RUN: llvm-objdump --section .got --full-contents %t.pie | FileCheck --check-prefix=PIE-GOT %s
23 # IE-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 4 entries:
24 # IE-REL: 0000000000003478 000000000000000c R_390_RELATIVE 2460
25 # IE-REL: 0000000000002460 0000000100000038 R_390_TLS_TPOFF 0000000000000008 a + 0
26 # IE-REL: 0000000000002468 0000000200000038 R_390_TLS_TPOFF 000000000000000c b + 0
27 # IE-REL: 0000000000002470 0000000300000038 R_390_TLS_TPOFF 0000000000000010 c + 0
29 ## TP offset for a is at 0x2460
30 # IE: lgrl %r1, 0x2460
31 # IE-NEXT: lgf %r1, 0(%r1,%r7)
33 ## TP offset for b is at 0x2468
34 # IE-NEXT: lgrl %r1, 0x2468
35 # IE-NEXT: lgf %r1, 0(%r1,%r7)
37 ## TP offset for c is at 0x2470
38 # IE-NEXT: lgrl %r1, 0x2470
39 # IE-NEXT: lgf %r1, 0(%r1,%r7)
41 ## Data element: TP offset for a is at 0x2460 (relocated via R_390_RELATIVE above)
42 # IE-DATA: 3478 00000000 00000000
44 # NOREL: no relocations
46 ## TP offset for a is at 0x1002250
47 # LE: lgrl %r1, 0x1002250
48 # LE-NEXT: lgf %r1, 0(%r1,%r7)
50 ## TP offset for b is at 0x1002258
51 # LE-NEXT: lgrl %r1, 0x1002258
52 # LE-NEXT: lgf %r1, 0(%r1,%r7)
54 ## TP offset for c is at 0x1002260
55 # LE-NEXT: lgrl %r1, 0x1002260
56 # LE-NEXT: lgf %r1, 0(%r1,%r7)
58 ## Data element: TP offset for a is at 0x1002250
59 # LE-DATA: 00000000 01002250
65 # LE-GOT: 1002238 00000000 00000000 00000000 00000000
66 # LE-GOT: 1002248 00000000 00000000 ffffffff fffffff8
67 # LE-GOT: 1002258 ffffffff fffffffc 00000000 00000000
69 # PIE-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
70 # PIE-REL: 00000000000033d0 000000000000000c R_390_RELATIVE 23b8
72 ## TP offset for a is at 0x23b8
73 # PIE: lgrl %r1, 0x23b8
74 # PIE-NEXT: lgf %r1, 0(%r1,%r7)
76 ## TP offset for b is at 0x23c0
77 # PIE-NEXT: lgrl %r1, 0x23c0
78 # PIE-NEXT: lgf %r1, 0(%r1,%r7)
80 ## TP offset for c is at 0x23c8
81 # PIE-NEXT: lgrl %r1, 0x23c8
82 # PIE-NEXT: lgf %r1, 0(%r1,%r7)
84 ## Data element: TP offset for a is at 0x23b8 (relocated via R_390_RELATIVE above)
85 # PIE-DATA: 33d0 00000000 00000000
91 # PIE-GOT: 23a0 00000000 000022d0 00000000 00000000
92 # PIE-GOT: 23b0 00000000 00000000 ffffffff fffffff8
93 # PIE-GOT: 23c0 ffffffff fffffffc 00000000 00000000
102 lgrl
%r1, b@indntpoff
105 lgrl
%r1, c@indntpoff
109 .reloc .,R_390_TLS_IE64,a