• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2# RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
3# RUN: llvm-mc -triple powerpc64le-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
4
5# RUN: llvm-mc -triple powerpc64-unknown-unknown -filetype=obj %s | \
6# RUN: llvm-readobj -r | FileCheck %s -check-prefix=CHECK-BE-REL
7# RUN: llvm-mc -triple powerpc64le-unknown-unknown -filetype=obj %s | \
8# RUN: llvm-readobj -r | FileCheck %s -check-prefix=CHECK-LE-REL
9
10# GOT references must result in explicit relocations
11# even if the target symbol is local.
12
13target:
14
15# CHECK-BE: addi 4, 3, target@GOT           # encoding: [0x38,0x83,A,A]
16# CHECK-LE: addi 4, 3, target@GOT           # encoding: [A,A,0x83,0x38]
17# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@GOT, kind: fixup_ppc_half16
18# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@GOT, kind: fixup_ppc_half16
19# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16 target 0x0
20# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16 target 0x0
21            addi 4, 3, target@got
22
23# CHECK-BE: ld 1, target@GOT(2)             # encoding: [0xe8,0x22,A,0bAAAAAA00]
24# CHECK-LE: ld 1, target@GOT(2)             # encoding: [0bAAAAAA00,A,0x22,0xe8]
25# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@GOT, kind: fixup_ppc_half16ds
26# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@GOT, kind: fixup_ppc_half16ds
27# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_DS target 0x0
28# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_DS target 0x0
29            ld 1, target@got(2)
30
31# CHECK-BE: addis 3, 2, target@got@ha       # encoding: [0x3c,0x62,A,A]
32# CHECK-LE: addis 3, 2, target@got@ha       # encoding: [A,A,0x62,0x3c]
33# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@ha, kind: fixup_ppc_half16
34# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@ha, kind: fixup_ppc_half16
35# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_HA target 0x0
36# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_HA target 0x0
37            addis 3, 2, target@got@ha
38
39# CHECK-BE: addi 4, 3, target@got@l         # encoding: [0x38,0x83,A,A]
40# CHECK-LE: addi 4, 3, target@got@l         # encoding: [A,A,0x83,0x38]
41# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@l, kind: fixup_ppc_half16
42# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@l, kind: fixup_ppc_half16
43# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_LO target 0x0
44# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_LO target 0x0
45            addi 4, 3, target@got@l
46
47# CHECK-BE: addis 3, 2, target@got@h        # encoding: [0x3c,0x62,A,A]
48# CHECK-LE: addis 3, 2, target@got@h        # encoding: [A,A,0x62,0x3c]
49# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@h, kind: fixup_ppc_half16
50# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@h, kind: fixup_ppc_half16
51# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_HI target 0x0
52# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_HI target 0x0
53            addis 3, 2, target@got@h
54
55# CHECK-BE: lwz 1, target@got@l(3)          # encoding: [0x80,0x23,A,A]
56# CHECK-LE: lwz 1, target@got@l(3)          # encoding: [A,A,0x23,0x80]
57# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@l, kind: fixup_ppc_half16
58# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@l, kind: fixup_ppc_half16
59# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_LO target 0x0
60# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_LO target 0x0
61            lwz 1, target@got@l(3)
62
63# CHECK-BE: ld 1, target@got@l(3)           # encoding: [0xe8,0x23,A,0bAAAAAA00]
64# CHECK-LE: ld 1, target@got@l(3)           # encoding: [0bAAAAAA00,A,0x23,0xe8]
65# CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@l, kind: fixup_ppc_half16ds
66# CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@l, kind: fixup_ppc_half16ds
67# CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_LO_DS target 0x0
68# CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_LO_DS target 0x0
69            ld 1, target@got@l(3)
70
71