1
2# RUN: llvm-mc -triple powerpc64-unknown-unknown -filetype=obj %s | \
3# RUN: llvm-readobj -s -sd | FileCheck -check-prefix=CHECK -check-prefix=CHECK-BE %s
4# RUN: llvm-mc -triple powerpc64le-unknown-unknown -filetype=obj %s | \
5# RUN: llvm-readobj -s -sd | FileCheck -check-prefix=CHECK -check-prefix=CHECK-LE %s
6
7# This checks that fixups that can be resolved within the same
8# object file are applied correctly.
9
10.text
11
12addi 1, 1, target
13addis 1, 1, target
14
15.set target, 0x1234
16
17subi 1, 1, -target2@l
18subis 1, 1, -target2@ha
19
20.set target2, 0x12345678
21
22addi 1, 1, target3-target4@l
23subis 1, 1, target4-target3@ha
24
25.set target3, 0x23455678
26.set target4, 0x12341234
27
28addi 1, 1, target5+0x8000@l
29addis 1, 1, target5+0x8000@ha
30ori 1, 1, target5+0x8000@l
31oris 1, 1, target5+0x8000@ha
32
33.set target5, 0x10000001
34
351:
36addi 1, 1, 2f-1b@l
37addis 1, 1, 1b-2f@ha
382:
39
40addi 1, 1, target6@h
41addis 1, 1, target6@h
42
43.set target6, 0x4321fedc
44
45addi 1, 1, target7@higher
46addis 1, 1, target7@highest
47addi 1, 1, target7@highera
48addis 1, 1, target7@highesta
49
50.set target7, 0x1234ffffffff8000
51
52.data
53
54.quad v1
55.long v2
56.short v3
57.byte v4
58
59.set v1, 0x123456789abcdef0
60.set v2, 0x87654321
61.set v3, 0xbeef
62.set v4, 0x42
63
64# CHECK:       Section {
65# CHECK:         Name: .text
66# CHECK-NEXT:    Type: SHT_PROGBITS
67# CHECK-NEXT:    Flags [
68# CHECK-NEXT:      SHF_ALLOC
69# CHECK-NEXT:      SHF_EXECINSTR
70# CHECK-NEXT:    ]
71# CHECK-NEXT:    Address: 0x0
72# CHECK-NEXT:    Offset:
73# CHECK-NEXT:    Size: 72
74# CHECK-NEXT:    Link: 0
75# CHECK-NEXT:    Info: 0
76# CHECK-NEXT:    AddressAlignment: 4
77# CHECK-NEXT:    EntrySize: 0
78# CHECK-NEXT:    SectionData (
79# CHECK-BE-NEXT:   0000: 38211234 3C211234 38215678 3C211234
80# CHECK-LE-NEXT:   0000: 34122138 3412213C 78562138 3412213C
81# CHECK-BE-NEXT:   0010: 38214444 3C211111 38218001 3C211001
82# CHECK-LE-NEXT:   0010: 44442138 1111213C 01802138 0110213C
83# CHECK-BE-NEXT:   0020: 60218001 64211001 38210008 3C210000
84# CHECK-LE-NEXT:   0020: 01802160 01102164 08002138 0000213C
85# CHECK-BE-NEXT:   0030: 38214321 3C214321 3821FFFF 3C211234
86# CHECK-LE-NEXT:   0030: 21432138 2143213C FFFF2138 3412213C
87# CHECK-BE-NEXT:   0040: 38210000 3C211235
88# CHECK-LE-NEXT:   0040: 00002138 3512213C
89# CHECK-NEXT:    )
90# CHECK-NEXT:  }
91
92# CHECK:        Section {
93# CHECK:          Name: .data
94# CHECK-NEXT:     Type: SHT_PROGBITS
95# CHECK-NEXT:     Flags [
96# CHECK-NEXT:       SHF_ALLOC
97# CHECK-NEXT:       SHF_WRITE
98# CHECK-NEXT:     ]
99# CHECK-NEXT:     Address: 0x0
100# CHECK-NEXT:     Offset:
101# CHECK-NEXT:     Size: 15
102# CHECK-NEXT:     Link: 0
103# CHECK-NEXT:     Info: 0
104# CHECK-NEXT:     AddressAlignment:
105# CHECK-NEXT:     EntrySize: 0
106# CHECK-NEXT:     SectionData (
107# CHECK-BE-NEXT:    0000: 12345678 9ABCDEF0 87654321 BEEF42
108# CHECK-LE-NEXT:    0000: F0DEBC9A 78563412 21436587 EFBE42
109# CHECK-NEXT:     )
110# CHECK-NEXT:   }
111
112