1# REQUIRES: systemz 2# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o 3 4# RUN: ld.lld -shared %t.o -o %t.so 5# RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=LD-REL %s 6# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=LD %s 7# RUN: llvm-objdump --section .data.rel.ro --full-contents %t.so | FileCheck --check-prefix=LD-DATA %s 8 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.rel.ro --full-contents %t | FileCheck --check-prefix=LE-DATA %s 13 14# LD-REL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries: 15# LD-REL: 00000000000024f8 0000000000000036 R_390_TLS_DTPMOD 0 16 17## _GLOBAL_OFFSET_TABLE is at 0x24e0 18# LD: larl %r12, 0x24e0 19 20## GOT offset of the LDM TLS module ID is at 0x23e0 21# LD-NEXT: lgrl %r2, 0x23e0 22# LD-NEXT: brasl %r14, 0x13c0 23# LD-NEXT: la %r2, 0(%r2,%r7) 24 25## DTP offset for a is at 0x23e8 26# LD-NEXT: lgrl %r1, 0x23e8 27# LD-NEXT: lgf %r1, 0(%r1,%r2) 28 29## DTP offset for b is at 0x23f0 30# LD-NEXT: lgrl %r1, 0x23f0 31# LD-NEXT: lgf %r1, 0(%r1,%r2) 32 33## DTP offset for c is at 0x23f8 34# LD-NEXT: lgrl %r1, 0x23f8 35# LD-NEXT: lgf %r1, 0(%r1,%r2) 36 37## Constant pool holding GOT offsets of TLS module ID and DTP offsets: 38# TLS module ID: 0x24f8 / 0x18 39# a: 8 40# b: 12 41# c: 16 42# LD-DATA: 23e0 00000000 00000018 00000000 00000008 43# LD-DATA: 23f0 00000000 0000000c 00000000 00000010 44 45# NOREL: no relocations 46 47## _GLOBAL_OFFSET_TABLE is at 0x1002230 48# LE: larl %r12, 0x1002230 49 50## GOT offset of the LDM TLS module ID is at 0x1002210 51# LE-NEXT: lgrl %r2, 0x1002210 52# LE-NEXT: jgnop 53# LE-NEXT: la %r2, 0(%r2,%r7) 54 55## TP offset for a is at 0x1002218 56# LE-NEXT: lgrl %r1, 0x1002218 57# LE-NEXT: lgf %r1, 0(%r1,%r2) 58 59## TP offset for b is at 0x1002220 60# LE-NEXT: lgrl %r1, 0x1002220 61# LE-NEXT: lgf %r1, 0(%r1,%r2) 62 63## TP offset for c is at 0x1002228 64# LE-NEXT: lgrl %r1, 0x1002228 65# LE-NEXT: lgf %r1, 0(%r1,%r2) 66 67## zeroed LDM / TP offsets: 68# LDM TLS: 0 69# a: -8 70# b: -4 71# c: 0 72# LE-DATA: 1002210 00000000 00000000 ffffffff fffffff8 73# LE-DATA: 1002220 ffffffff fffffffc 00000000 00000000 74 75 76ear %r7,%a0 77sllg %r7,%r1,32 78ear %r7,%a1 79larl %r12,_GLOBAL_OFFSET_TABLE_ 80 81lgrl %r2,.LC0 82brasl %r14,__tls_get_offset@PLT:tls_ldcall:a 83la %r2,0(%r2,%r7) 84 85lgrl %r1, .LC1 86lgf %r1,0(%r1,%r2) 87 88lgrl %r1, .LC2 89lgf %r1,0(%r1,%r2) 90 91lgrl %r1, .LC3 92lgf %r1,0(%r1,%r2) 93 94 .section .data.rel.ro,"aw" 95 .align 8 96.LC0: 97 .quad a@TLSLDM 98.LC1: 99 .quad a@DTPOFF 100.LC2: 101 .quad b@DTPOFF 102.LC3: 103 .quad c@DTPOFF 104 105 .section .tbss 106 .globl a 107 .globl b 108 .globl c 109 .zero 8 110a: 111 .zero 4 112b: 113 .zero 4 114c: 115