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_TOC,"a",@progbits
44  .quad .TOC.@tocbase
45
46# SEC: .got PROGBITS 0000000010020208
47
48## tocbase = .got+0x8000 = 0x10028208
49# DATALE-LABEL: section '.R_PPC64_TOC':
50# DATALE-NEXT:    e8810210 00000000
51
52# DATABE-LABEL: section '.R_PPC64_TOC':
53# DATABE-NEXT:    00000000 100281e8
54