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
17addi 1, 1, target2@l
18addis 1, 1, target2@ha
19
20.set target2, 0x12345678
21
22addi 1, 1, target3-target4@l
23addis 1, 1, target3-target4@ha
24
25.set target3, 0x23455678
26.set target4, 0x12341234
27
28addi 1, 1, target5+0x8000@l
29addis 1, 1, target5+0x8000@ha
30
31.set target5, 0x10000001
32
331:
34addi 1, 1, 2f-1b@l
35addis 1, 1, 1b-2f@ha
362:
37
38addi 1, 1, target6@h
39addis 1, 1, target6@h
40
41.set target6, 0x4321fedc
42
43addi 1, 1, target7@higher
44addis 1, 1, target7@highest
45addi 1, 1, target7@highera
46addis 1, 1, target7@highesta
47
48.set target7, 0x1234ffffffff8000
49
50.data
51
52.quad v1
53.long v2
54.short v3
55.byte v4
56
57.set v1, 0x123456789abcdef0
58.set v2, 0x87654321
59.set v3, 0xbeef
60.set v4, 0x42
61
62# CHECK:       Section {
63# CHECK:         Name: .text
64# CHECK-NEXT:    Type: SHT_PROGBITS
65# CHECK-NEXT:    Flags [
66# CHECK-NEXT:      SHF_ALLOC
67# CHECK-NEXT:      SHF_EXECINSTR
68# CHECK-NEXT:    ]
69# CHECK-NEXT:    Address: 0x0
70# CHECK-NEXT:    Offset:
71# CHECK-NEXT:    Size: 64
72# CHECK-NEXT:    Link: 0
73# CHECK-NEXT:    Info: 0
74# CHECK-NEXT:    AddressAlignment: 4
75# CHECK-NEXT:    EntrySize: 0
76# CHECK-NEXT:    SectionData (
77# CHECK-BE-NEXT:   0000: 38211234 3C211234 38215678 3C211234
78# CHECK-LE-NEXT:   0000: 34122138 3412213C 78562138 3412213C
79# CHECK-BE-NEXT:   0010: 38214444 3C211111 38218001 3C211001
80# CHECK-LE-NEXT:   0010: 44442138 1111213C 01802138 0110213C
81# CHECK-BE-NEXT:   0020: 38210008 3C210000 38214321 3C214321
82# CHECK-LE-NEXT:   0020: 08002138 0000213C 21432138 2143213C
83# CHECK-BE-NEXT:   0030: 3821FFFF 3C211234 38210000 3C211235
84# CHECK-LE-NEXT:   0030: FFFF2138 3412213C 00002138 3512213C
85# CHECK-NEXT:    )
86# CHECK-NEXT:  }
87
88# CHECK:        Section {
89# CHECK:          Name: .data
90# CHECK-NEXT:     Type: SHT_PROGBITS
91# CHECK-NEXT:     Flags [
92# CHECK-NEXT:       SHF_ALLOC
93# CHECK-NEXT:       SHF_WRITE
94# CHECK-NEXT:     ]
95# CHECK-NEXT:     Address: 0x0
96# CHECK-NEXT:     Offset:
97# CHECK-NEXT:     Size: 15
98# CHECK-NEXT:     Link: 0
99# CHECK-NEXT:     Info: 0
100# CHECK-NEXT:     AddressAlignment: 4
101# CHECK-NEXT:     EntrySize: 0
102# CHECK-NEXT:     SectionData (
103# CHECK-BE-NEXT:    0000: 12345678 9ABCDEF0 87654321 BEEF42
104# CHECK-LE-NEXT:    0000: F0DEBC9A 78563412 21436587 EFBE42
105# CHECK-NEXT:     )
106# CHECK-NEXT:   }
107
108