2 # RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
4 # RUN: ld.lld -shared %t.o -o %t.so
5 # RUN: llvm-readobj -d -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
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
12 # IE-REL: FLAGS STATIC_TLS
13 ## A non-preemptable symbol (b) has 0 st_shndx.
15 # IE-REL-NEXT: 0x20258 R_PPC_TPREL32 - 0xC
16 # IE-REL-NEXT: 0x20254 R_PPC_TPREL32 a 0x0
19 ## &.got[3] - _GLOBAL_OFFSET_TABLE_ = 12
21 # IE-NEXT: add 10, 10, 2
22 ## &.got[4] - _GLOBAL_OFFSET_TABLE_ = 16
23 # IE-NEXT: lwz 8, 16(7)
24 # IE-NEXT: lbzx 10, 8, 2
26 # NOREL: no relocations
28 ## a@tprel = st_value(a)-0x7000 = -28664
29 ## b@tprel = st_value(b)-0x7000 = -28660
31 # LE-NEXT: addi 10, 10, -28664
32 # LE-NEXT: addis 8, 2, 0
33 # LE-NEXT: lbz 10, -28660(8)
35 lwz 10, a@got@tprel
(9)
41 ## In IE, these instructions (op rT, rA, x@tls) are not changed.
42 # IE-NEXT: lhzx 12, 2, 2
43 # IE-NEXT: lwzx 13, 3, 2
44 # IE-NEXT: stbx 14, 4, 2
45 # IE-NEXT: sthx 15, 5, 2
46 # IE-NEXT: stwx 16, 6, 2
47 # IE-NEXT: lhax 17, 7, 2
48 # IE-NEXT: lwax 18, 8, 2
49 # IE-NEXT: lfsx 19, 9, 2
50 # IE-NEXT: lfdx 20, 10, 2
51 # IE-NEXT: stfsx 21, 11, 2
52 # IE-NEXT: stfdx 22, 12, 2
54 ## In LE, these X-Form instructions are changed to their corresponding D-Form.
55 # LE-NEXT: lhz 12, -28660(2)
56 # LE-NEXT: lwz 13, -28660(3)
57 # LE-NEXT: stb 14, -28660(4)
58 # LE-NEXT: sth 15, -28660(5)
59 # LE-NEXT: stw 16, -28660(6)
60 # LE-NEXT: lha 17, -28660(7)
61 # LE-NEXT: lwa 18, -28660(8)
62 # LE-NEXT: lfs 19, -28660(9)
63 # LE-NEXT: lfd 20, -28660(10)
64 # LE-NEXT: stfs 21, -28660(11)
65 # LE-NEXT: stfd 22, -28660(12)