2 # RUN: echo 'SECTIONS { \
3 # RUN: .text_low 0x2000: { *(.text_low) } \
4 # RUN: .text_high 0x2002000 : { *(.text_high) } \
7 # RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
8 # RUN: ld.lld -T %t.script %t.o -o %t
9 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC %s
10 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PD %s
11 # RUN: llvm-nm --no-sort %t | FileCheck --check-prefix=NM %s
13 # RUN: ld.lld -T %t.script -pie %t.o -o %t
14 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC %s
15 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PI %s
16 # RUN: llvm-nm --no-sort %t | FileCheck --check-prefix=NM %s
18 # SEC: There are no relocations in this file.
21 # CHECK-NEXT: 2000: bl 0x2018
22 # CHECK-NEXT: bl 0x2018
23 # CHECK-NEXT: bl 0x2018
24 # CHECK-NEXT: bl 0x2002008
28 ## high = 0x02002008 = 65536*512+8200
29 # PD: <__LongThunk_high>:
30 # PD-NEXT: 2018: lis 12, 512
31 # PD-NEXT: addi 12, 12, 8200
35 ## .text_high+16 = 0x02002010 = 65536*512+8208
37 # PD-NEXT: 2028: lis 12, 512
38 # PD-NEXT: addi 12, 12, 8208
42 ## high-0x2028 = 0x02002008-0x2020 = 65536*512-24
43 # PI: <__LongThunk_high>:
44 # PI-NEXT: 2018: mflr 0
45 # PI-NEXT: bcl 20, 31, 0x2020
46 # PI-NEXT: 2020: mflr 12
47 # PI-NEXT: addis 12, 12, 512
48 # PI-NEXT: addi 12, 12, -24
53 ## .text_high+16-0x2048 = 0x02002010-0x2048 = 65536*512-48
55 # PI-NEXT: 2038: mflr 0
56 # PI-NEXT: bcl 20, 31, 0x2040
57 # PI-NEXT: 2040: mflr 12
58 # PI-NEXT: addis 12, 12, 512
59 # PI-NEXT: addi 12, 12, -48
64 .section .text_low, "ax", %progbits
67 bl high@local
# Need a thunk
68 bl high@local
# Need a thunk
69 bl high+
32768@plt
# Need a thunk
71 bl .text_high+16 # Need a thunk
74 # PD: 02002008 <high>:
76 # PD-NEXT: bl 0x2002010
78 # PD-NEXT: 2002010: lis 12, 0
79 # PD-NEXT: addi 12, 12, 8200
83 .section .text_high, "ax", %progbits
89 bl .text_low+8 # Need a thunk
91 # NM: t __LongThunk_high
92 # NM-NEXT: t __LongThunk_
93 # NM-NEXT: t __LongThunk_