[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / ppc32-long-thunk.s
blob4f370ddc028e7dbba1453fed31871693c195980b
1 # REQUIRES: ppc
2 # RUN: echo 'SECTIONS { \
3 # RUN: .text_low 0x2000: { *(.text_low) } \
4 # RUN: .text_high 0x2002000 : { *(.text_high) } \
5 # RUN: }' > %t.script
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.
20 # CHECK: <_start>:
21 # CHECK-NEXT: 2000: bl 0x2018
22 # CHECK-NEXT: bl 0x2018
23 # CHECK-NEXT: bl 0x2018
24 # CHECK-NEXT: bl 0x2002008
25 # PD-NEXT: bl 0x2028
26 # PI-NEXT: bl 0x2038
28 ## high = 0x02002008 = 65536*512+8200
29 # PD: <__LongThunk_high>:
30 # PD-NEXT: 2018: lis 12, 512
31 # PD-NEXT: addi 12, 12, 8200
32 # PD-NEXT: mtctr 12
33 # PD-NEXT: bctr
35 ## .text_high+16 = 0x02002010 = 65536*512+8208
36 # PD: <__LongThunk_>:
37 # PD-NEXT: 2028: lis 12, 512
38 # PD-NEXT: addi 12, 12, 8208
39 # PD-NEXT: mtctr 12
40 # PD-NEXT: bctr
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
49 # PI-NEXT: mtlr 0
50 # PI-NEXT: mtctr 12
51 # PI-NEXT: bctr
53 ## .text_high+16-0x2048 = 0x02002010-0x2048 = 65536*512-48
54 # PI: <__LongThunk_>:
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
60 # PI-NEXT: mtlr 0
61 # PI-NEXT: mtctr 12
62 # PI-NEXT: bctr
64 .section .text_low, "ax", %progbits
65 .globl _start
66 _start:
67 bl high@local # Need a thunk
68 bl high@local # Need a thunk
69 bl high+32768@plt # Need a thunk
70 bl high
71 bl .text_high+16 # Need a thunk
72 blr
74 # PD: 02002008 <high>:
75 # PD-NEXT: bl 0x2008
76 # PD-NEXT: bl 0x2002010
77 # PD: <__LongThunk_>:
78 # PD-NEXT: 2002010: lis 12, 0
79 # PD-NEXT: addi 12, 12, 8200
80 # PD-NEXT: mtctr 12
81 # PD-NEXT: bctr
83 .section .text_high, "ax", %progbits
84 nop
85 nop
86 .globl high
87 high:
88 bl .text_low+8
89 bl .text_low+8 # Need a thunk
91 # NM: t __LongThunk_high
92 # NM-NEXT: t __LongThunk_
93 # NM-NEXT: t __LongThunk_
94 # NM-NEXT: T _start
95 # NM-NEXT: T high