1# REQUIRES: ppc 2# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o 3 4# RUN: ld.lld -shared %t.o -o %t.so 5# RUN: llvm-readobj -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 8# RUN: ld.lld %t.o -o %t 9# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s 10# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s 11 12## A non-preemptable symbol (b) has 0 st_shndx. 13# IE-REL: .rela.dyn { 14# IE-REL-NEXT: 0x20224 R_PPC_TPREL32 - 0xC 15# IE-REL-NEXT: 0x20220 R_PPC_TPREL32 a 0x0 16# IE-REL-NEXT: } 17 18## &.got[0] - _GLOBAL_OFFSET_TABLE_ = 0 19# IE: lwz 10, 0(9) 20# IE-NEXT: add 10, 10, 2 21## &.got[1] - _GLOBAL_OFFSET_TABLE_ = 4 22# IE-NEXT: lwz 8, 4(7) 23# IE-NEXT: lbzx 10, 8, 2 24 25# NOREL: no relocations 26 27## a@tprel = st_value(a)-0x7000 = -28664 28## b@tprel = st_value(b)-0x7000 = -28660 29# LE: addis 10, 2, 0 30# LE-NEXT: addi 10, 10, -28664 31# LE-NEXT: addis 8, 2, 0 32# LE-NEXT: lbz 10, -28660(8) 33 34lwz 10, a@got@tprel(9) 35add 10, 10, a@tls 36 37lwz 8, c@got@tprel(7) 38lbzx 10, 8, c@tls 39 40## In IE, these instructions (op rT, rA, x@tls) are not changed. 41# IE-NEXT: lhzx 12, 2, 2 42# IE-NEXT: lwzx 13, 3, 2 43# IE-NEXT: stbx 14, 4, 2 44# IE-NEXT: sthx 15, 5, 2 45# IE-NEXT: stwx 16, 6, 2 46 47## In LE, these X-Form instructions are changed to their corresponding D-Form. 48# LE-NEXT: lhz 12, -28660(2) 49# LE-NEXT: lwz 13, -28660(3) 50# LE-NEXT: stb 14, -28660(4) 51# LE-NEXT: sth 15, -28660(5) 52# LE-NEXT: stw 16, -28660(6) 53 54lhzx 12, 2, s@tls 55lwzx 13, 3, i@tls 56stbx 14, 4, c@tls 57sthx 15, 5, s@tls 58stwx 16, 6, i@tls 59 60.section .tbss 61.globl a 62.zero 8 63a: 64.zero 4 65c: 66s: 67i: 68