• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: ppc
2
3# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
4# RUN: ld.lld --no-toc-optimize %t.o -o %t
5# RUN: llvm-readelf -x .rodata -x .R_PPC64_TOC -x .eh_frame %t | FileCheck %s --check-prefix=DATALE
6# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
7
8# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
9# RUN: ld.lld --no-toc-optimize %t.o -o %t
10# RUN: llvm-readelf -x .rodata -x .R_PPC64_TOC -x .eh_frame %t | FileCheck %s --check-prefix=DATABE
11# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
12
13.text
14.global _start
15_start:
16.Lfoo:
17	li      0,1
18	li      3,42
19	sc
20
21.section .toc,"aw",@progbits
22.L1:
23  .quad 22, 37, 89, 47
24
25.section .R_PPC64_TOC16_LO_DS,"ax",@progbits
26  ld 1, .L1@toc@l(2)
27
28# CHECK-LABEL: Disassembly of section .R_PPC64_TOC16_LO_DS:
29# CHECK: ld 1, -32760(2)
30
31.section .R_PPC64_TOC16_LO,"ax",@progbits
32  addi  1, 2, .L1@toc@l
33
34# CHECK-LABEL: Disassembly of section .R_PPC64_TOC16_LO:
35# CHECK: addi 1, 2, -32760
36
37.section .R_PPC64_TOC16_HI,"ax",@progbits
38  addis 1, 2, .L1@toc@h
39
40# CHECK-LABEL: Disassembly of section .R_PPC64_TOC16_HI:
41# CHECK: addis 1, 2, -1
42
43.section .R_PPC64_TOC16_HA,"ax",@progbits
44  addis 1, 2, .L1@toc@ha
45
46# CHECK-LABEL: Disassembly of section .R_PPC64_TOC16_HA:
47# CHECK: addis 1, 2, 0
48
49.section .R_PPC64_ADDR16_LO,"ax",@progbits
50  li 1, .Lfoo@l
51
52# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_LO:
53# CHECK: li 1, 464
54
55.section .R_PPC64_ADDR16_HI,"ax",@progbits
56  li 1, .Lfoo@h
57
58# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HI:
59# CHECK: li 1, 4097
60
61.section .R_PPC64_ADDR16_HA,"ax",@progbits
62  li 1, .Lfoo@ha
63
64# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HA:
65# CHECK: li 1, 4097
66
67.section .R_PPC64_ADDR16_HIGHER,"ax",@progbits
68  li 1, .Lfoo@higher
69
70# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHER:
71# CHECK: li 1, 0
72
73.section .R_PPC64_ADDR16_HIGHERA,"ax",@progbits
74  li 1, .Lfoo@highera
75
76# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHERA:
77# CHECK: li 1, 0
78
79.section .R_PPC64_ADDR16_HIGHEST,"ax",@progbits
80  li 1, .Lfoo@highest
81
82# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHEST:
83# CHECK: li 1, 0
84
85.section .R_PPC64_ADDR16_HIGHESTA,"ax",@progbits
86  li 1, .Lfoo@highesta
87
88# CHECK-LABEL: Disassembly of section .R_PPC64_ADDR16_HIGHESTA:
89# CHECK: li 1, 0
90
91.section .R_PPC64_TOC,"a",@progbits
92  .quad .TOC.@tocbase
93
94# SEC: .got PROGBITS 0000000010020208
95
96## tocbase = .got+0x8000 = 0x10028208
97# DATALE-LABEL: section '.R_PPC64_TOC':
98# DATALE: 08820210 00000000
99
100# DATABE-LABEL: section '.R_PPC64_TOC':
101# DATABE: 00000000 10028208
102