143 lines · plain
1# REQUIRES: systemz2# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o3# RUN: echo '.tbss; .globl b, c; b: .zero 4; c:' | llvm-mc -filetype=obj -triple=s390x-unknown-linux - -o %t1.o4# RUN: ld.lld -shared -soname=t1.so %t1.o -o %t1.so5 6# RUN: ld.lld -shared %t.o %t1.o -o %t.so7# RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=GD-REL %s8# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=GD %s9# RUN: llvm-objdump --section .data.rel.ro --full-contents %t.so | FileCheck --check-prefix=GD-DATA %s10 11# RUN: ld.lld %t.o %t1.o -o %t.le12# RUN: llvm-readelf -r %t.le | FileCheck --check-prefix=NOREL %s13# RUN: llvm-objdump -d --no-show-raw-insn %t.le | FileCheck --check-prefix=LE %s14# RUN: llvm-objdump --section .data.rel.ro --full-contents %t.le | FileCheck --check-prefix=LE-DATA %s15 16# RUN: ld.lld %t.o %t1.so -o %t.ie17# RUN: llvm-readelf -r %t.ie | FileCheck --check-prefix=IE-REL %s18# RUN: llvm-objdump -d --no-show-raw-insn %t.ie | FileCheck --check-prefix=IE %s19# RUN: llvm-objdump --section .data.rel.ro --full-contents %t.ie | FileCheck --check-prefix=IE-DATA %s20 21# GD-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 6 entries:22# GD-REL: 0000000000002570 0000000200000036 R_390_TLS_DTPMOD 0000000000000008 a + 023# GD-REL-NEXT: 0000000000002578 0000000200000037 R_390_TLS_DTPOFF 0000000000000008 a + 024# GD-REL-NEXT: 0000000000002580 0000000300000036 R_390_TLS_DTPMOD 000000000000000c b + 025# GD-REL-NEXT: 0000000000002588 0000000300000037 R_390_TLS_DTPOFF 000000000000000c b + 026# GD-REL-NEXT: 0000000000002590 0000000400000036 R_390_TLS_DTPMOD 0000000000000010 c + 027# GD-REL-NEXT: 0000000000002598 0000000400000037 R_390_TLS_DTPOFF 0000000000000010 c + 028 29## _GLOBAL_OFFSET_TABLE is at 0x255830# GD: larl %r12, 0x255831 32## GOT offset of the TLS module ID / offset pair for a is at 0x246033# GD-NEXT: lgrl %r2, 0x246034# GD-NEXT: brasl %r14, 0x144035# GD-NEXT: lgf %r2, 0(%r2,%r7)36 37## GOT offset of the TLS module ID / offset pair for b is at 0x246838# GD-NEXT: lgrl %r2, 0x246839# GD-NEXT: brasl %r14, 0x144040# GD-NEXT: lgf %r2, 0(%r2,%r7)41 42## GOT offset of the TLS module ID / offset pair for c is at 0x247043# GD-NEXT: lgrl %r2, 0x247044# GD-NEXT: brasl %r14, 0x144045# GD-NEXT: lgf %r2, 0(%r2,%r7)46 47## Constant pool holding GOT offsets of TLS module ID / offset pairs:48# a: 0x2570 / 0x1849# b: 0x2580 / 0x2850# c: 0x2590 / 0x3851# GD-DATA: 2460 00000000 00000018 00000000 0000002852# GD-DATA-NEXT: 2470 00000000 0000003853 54# NOREL: no relocations55 56## _GLOBAL_OFFSET_TABLE is at 0x100223057# LE: larl %r12, 0x100223058 59## TP offset of a is at 0x100221860# LE-NEXT: lgrl %r2, 0x100221861# LE-NEXT: jgnop62# LE-NEXT: lgf %r2, 0(%r2,%r7)63 64## TP offset of b is at 0x100222065# LE-NEXT: lgrl %r2, 0x100222066# LE-NEXT: jgnop67# LE-NEXT: lgf %r2, 0(%r2,%r7)68 69## TP offset of c is at 0x100222870# LE-NEXT: lgrl %r2, 0x100222871# LE-NEXT: jgnop72# LE-NEXT: lgf %r2, 0(%r2,%r7)73 74## TP offsets75# a: -876# b: -477# c: 078# LE-DATA: 1002218 ffffffff fffffff8 ffffffff fffffffc79# LE-DATA-NEXT: 1002228 00000000 0000000080 81 82# IE-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:83# IE-REL: 0000000001002430 0000000200000038 R_390_TLS_TPOFF 0000000000000000 b + 084# IE-REL-NEXT: 0000000001002438 0000000300000038 R_390_TLS_TPOFF 0000000000000000 c + 085 86## _GLOBAL_OFFSET_TABLE is at 0x100241887# IE: larl %r12, 0x100241888 89## TP offset of a is at 0x100234090# IE-NEXT: lgrl %r2, 0x100234091# IE-NEXT: jgnop92# IE-NEXT: lgf %r2, 0(%r2,%r7)93 94## GOT offset of the TP offset for b is at 0x100234895# IE-NEXT: lgrl %r2, 0x100234896# IE-NEXT: lg %r2, 0(%r2,%r12)97# IE-NEXT: lgf %r2, 0(%r2,%r7)98 99## GOT offset of the TP offset for c is at 0x1002350100# IE-NEXT: lgrl %r2, 0x1002350101# IE-NEXT: lg %r2, 0(%r2,%r12)102# IE-NEXT: lgf %r2, 0(%r2,%r7)103 104## TP offsets (a) / GOT offset of TP offsets (b, c)105# a: -4106# b: 0x1002430 / 0x18107# c: 0x1002438 / 0x20108# IE-DATA: 1002340 ffffffff fffffffc 00000000 00000018109# IE-DATA-NEXT: 1002350 00000000 00000020110 111 112ear %r7,%a0113sllg %r7,%r1,32114ear %r7,%a1115larl %r12,_GLOBAL_OFFSET_TABLE_116 117lgrl %r2,.LC0118brasl %r14,__tls_get_offset@PLT:tls_gdcall:a119lgf %r2,0(%r2,%r7)120 121lgrl %r2,.LC1122brasl %r14,__tls_get_offset@PLT:tls_gdcall:b123lgf %r2,0(%r2,%r7)124 125lgrl %r2,.LC2126brasl %r14,__tls_get_offset@PLT:tls_gdcall:c127lgf %r2,0(%r2,%r7)128 129 .section .data.rel.ro,"aw"130 .align 8131.LC0:132 .quad a@TLSGD133.LC1:134 .quad b@TLSGD135.LC2:136 .quad c@TLSGD137 138 .section .tbss139 .globl a140 .zero 8141a:142 .zero 4143