1# REQUIRES: ppc 2 3# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o 4# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s 5## IE 6# RUN: ld.lld -shared %t.o -o %t.so 7# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=IE-REL %s 8# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s 9## IE -> LE 10# RUN: ld.lld %t.o -o %t 11# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s 12# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s 13 14# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o 15# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s 16## IE 17# RUN: ld.lld -shared %t.o -o %t.so 18# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=IE-REL %s 19# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s 20## IE -> LE 21# RUN: ld.lld %t.o -o %t 22# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s 23# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s 24 25# IE-REL: .rela.dyn { 26# IE-REL-NEXT: 0x204A0 R_PPC64_TPREL64 c 0x0 27# IE-REL-NEXT: 0x204B0 R_PPC64_TPREL64 i 0x0 28# IE-REL-NEXT: 0x204B8 R_PPC64_TPREL64 l 0x0 29# IE-REL-NEXT: 0x204A8 R_PPC64_TPREL64 s 0x0 30# IE-REL-NEXT: } 31 32# INPUT-REL: R_PPC64_GOT_TPREL16_HA c 0x0 33# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS c 0x0 34# INPUT-REL: R_PPC64_TLS c 0x0 35## &.got[0] - .TOC. = -32768 36# IE-LABEL: <test1>: 37# IE-NEXT: addis 3, 2, 0 38# IE-NEXT: ld 3, -32768(3) 39# IE-NEXT: lbzx 3, 3, 13 40# LE-LABEL: <test1>: 41# LE-NEXT: nop 42# LE-NEXT: addis 3, 13, 0 43# LE-NEXT: lbz 3, -28672(3) 44test1: 45 addis 3, 2, c@got@tprel@ha 46 ld 3, c@got@tprel@l(3) 47 lbzx 3, 3, c@tls 48 49# INPUT-REL: R_PPC64_GOT_TPREL16_HA s 0x0 50# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS s 0x0 51# INPUT-REL: R_PPC64_TLS s 0x0 52## &.got[1] - .TOC. = -32760 53# IE-LABEL: <test2>: 54# IE-NEXT: addis 3, 2, 0 55# IE-NEXT: ld 3, -32760(3) 56# IE-NEXT: lhzx 3, 3, 13 57# LE-LABEL: <test2>: 58# LE-NEXT: nop 59# LE-NEXT: addis 3, 13, 0 60# LE-NEXT: lhz 3, -28670(3) 61test2: 62 addis 3, 2, s@got@tprel@ha 63 ld 3, s@got@tprel@l(3) 64 lhzx 3, 3, s@tls 65 66# INPUT-REL: R_PPC64_GOT_TPREL16_HA i 0x0 67# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS i 0x0 68# INPUT-REL: R_PPC64_TLS i 0x0 69## &.got[2] - .TOC. = -32752 70# IE-LABEL: <test3>: 71# IE-NEXT: addis 3, 2, 0 72# IE-NEXT: ld 3, -32752(3) 73# IE-NEXT: lwzx 3, 3, 13 74# LE-LABEL: <test3>: 75# LE-NEXT: nop 76# LE-NEXT: addis 3, 13, 0 77# LE-NEXT: lwz 3, -28668(3) 78test3: 79 addis 3, 2, i@got@tprel@ha 80 ld 3, i@got@tprel@l(3) 81 lwzx 3, 3, i@tls 82 83# INPUT-REL: R_PPC64_GOT_TPREL16_HA l 0x0 84# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS l 0x0 85# INPUT-REL: R_PPC64_TLS l 0x0 86## &.got[3] - .TOC. = -32744 87# IE-LABEL: <test4>: 88# IE-NEXT: addis 3, 2, 0 89# IE-NEXT: ld 3, -32744(3) 90# IE-NEXT: ldx 3, 3, 13 91# LE-LABEL: <test4>: 92# LE-NEXT: nop 93# LE-NEXT: addis 3, 13, 0 94# LE-NEXT: ld 3, -28664(3) 95test4: 96 addis 3, 2, l@got@tprel@ha 97 ld 3, l@got@tprel@l(3) 98 ldx 3, 3, l@tls 99 100# LE-LABEL: <test5>: 101# LE-NEXT: nop 102# LE-NEXT: addis 4, 13, 0 103# LE-NEXT: stb 3, -28672(4) 104test5: 105 addis 4, 2, c@got@tprel@ha 106 ld 4, c@got@tprel@l(4) 107 stbx 3, 4, c@tls 108 109 110# LE-LABEL: <test6>: 111# LE-NEXT: nop 112# LE-NEXT: addis 4, 13, 0 113# LE-NEXT: sth 3, -28670(4) 114test6: 115 addis 4, 2, s@got@tprel@ha 116 ld 4, s@got@tprel@l(4) 117 sthx 3, 4, s@tls 118 119 120# LE-LABEL: <test7>: 121# LE-NEXT: nop 122# LE-NEXT: addis 4, 13, 0 123# LE-NEXT: stw 3, -28668(4) 124test7: 125 addis 4, 2, i@got@tprel@ha 126 ld 4, i@got@tprel@l(4) 127 stwx 3, 4, i@tls 128 129# LE-LABEL: <test8>: 130# LE-NEXT: nop 131# LE-NEXT: addis 4, 13, 0 132# LE-NEXT: std 3, -28664(4) 133test8: 134 addis 4, 2, l@got@tprel@ha 135 ld 4, l@got@tprel@l(4) 136 stdx 3, 4, l@tls 137 138# LE-LABEL: <test9>: 139# LE-NEXT: nop 140# LE-NEXT: addis 3, 13, 0 141# LE-NEXT: addi 3, 3, -28668 142test9: 143 addis 3, 2, i@got@tprel@ha 144 ld 3, i@got@tprel@l(3) 145 add 3, 3, i@tls 146 147# LE-LABEL: <test_ds>: 148# LE-NEXT: addis 4, 13, 0 149# LE-NEXT: std 3, -28664(4) 150test_ds: 151 ld 4, l@got@tprel(2) 152 stdx 3, 4, l@tls 153 154# NOREL: There are no relocations in this file. 155 156.section .tdata,"awT",@progbits 157.globl c, s, i, l 158c: 159.byte 97 160 161.p2align 1 162s: 163.short 55 164 165.p2align 2 166i: 167.long 55 168 169.p2align 3 170l: 171.quad 55 172