File: ppc32-long-thunk.s

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (95 lines) | stat: -rw-r--r-- 2,885 bytes parent folder | download | duplicates (24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# REQUIRES: ppc
# RUN: echo 'SECTIONS { \
# RUN:       .text_low 0x2000: { *(.text_low) } \
# RUN:       .text_high 0x2002000 : { *(.text_high) } \
# RUN:       }' > %t.script

# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
# RUN: ld.lld -T %t.script %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PD %s
# RUN: llvm-nm --no-sort %t | FileCheck --check-prefix=NM %s

# RUN: ld.lld -T %t.script -pie %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefixes=CHECK,PI %s
# RUN: llvm-nm --no-sort %t | FileCheck --check-prefix=NM %s

# SEC: There are no relocations in this file.

# CHECK:      <_start>:
# CHECK-NEXT:     2000: bl 0x2018
# CHECK-NEXT:           bl 0x2018
# CHECK-NEXT:           bl 0x2018
# CHECK-NEXT:           bl 0x2002008
# PD-NEXT:              bl 0x2028
# PI-NEXT:              bl 0x2038

## high = 0x02002008 = 65536*512+8200
# PD:         <__LongThunk_high>:
# PD-NEXT:        2018: lis 12, 512
# PD-NEXT:              addi 12, 12, 8200
# PD-NEXT:              mtctr 12
# PD-NEXT:              bctr

## .text_high+16 = 0x02002010 = 65536*512+8208
# PD:         <__LongThunk_>:
# PD-NEXT:        2028: lis 12, 512
# PD-NEXT:              addi 12, 12, 8208
# PD-NEXT:              mtctr 12
# PD-NEXT:              bctr

## high-0x2028 = 0x02002008-0x2020 = 65536*512-24
# PI:         <__LongThunk_high>:
# PI-NEXT:        2018: mflr 0
# PI-NEXT:              bcl 20, 31, 0x2020
# PI-NEXT:        2020: mflr 12
# PI-NEXT:              addis 12, 12, 512
# PI-NEXT:              addi 12, 12, -24
# PI-NEXT:              mtlr 0
# PI-NEXT:              mtctr 12
# PI-NEXT:              bctr

## .text_high+16-0x2048 = 0x02002010-0x2048 = 65536*512-48
# PI:         <__LongThunk_>:
# PI-NEXT:        2038: mflr 0
# PI-NEXT:              bcl 20, 31, 0x2040
# PI-NEXT:        2040: mflr 12
# PI-NEXT:              addis 12, 12, 512
# PI-NEXT:              addi 12, 12, -48
# PI-NEXT:              mtlr 0
# PI-NEXT:              mtctr 12
# PI-NEXT:              bctr

.section .text_low, "ax", %progbits
.globl _start
_start:
bl high@local     # Need a thunk
bl high@local     # Need a thunk
bl high+32768@plt # Need a thunk
bl high
bl .text_high+16  # Need a thunk
blr

# PD:         02002008 <high>:
# PD-NEXT:              bl 0x2008
# PD-NEXT:              bl 0x2002010
# PD:         <__LongThunk_>:
# PD-NEXT:     2002010: lis 12, 0
# PD-NEXT:              addi 12, 12, 8200
# PD-NEXT:              mtctr 12
# PD-NEXT:              bctr

.section .text_high, "ax", %progbits
nop
nop
.globl high
high:
bl .text_low+8
bl .text_low+8    # Need a thunk

# NM:      t __LongThunk_high
# NM-NEXT: t __LongThunk_
# NM-NEXT: t __LongThunk_
# NM-NEXT: T _start
# NM-NEXT: T high