File: mips-npic-call-pic.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (104 lines) | stat: -rw-r--r-- 3,814 bytes parent folder | download | duplicates (14)
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
96
97
98
99
100
101
102
103
104
# REQUIRES: mips
# Check LA25 stubs creation. This stub code is necessary when
# non-PIC code calls PIC function.

# RUN: echo "SECTIONS { \
# RUN:         . = 0x20000; .text ALIGN(0x100) : { *(.text) *(.text.*) } \
# RUN:       }" > %t.script

# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN:   %p/Inputs/mips-fpic.s -o %t-fpic.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN:   %p/Inputs/mips-fnpic.s -o %t-fnpic.o
# RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic-r2.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN:   %p/Inputs/mips-pic.s -o %t-pic-r2.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r2 \
# RUN:   %s -o %t-npic-r2.o
# RUN: ld.lld %t-npic-r2.o %t-pic-r2.o %t-sto-pic-r2.o \
# RUN:        -script %t.script -o %t-r2.exe
# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t-r2.exe \
# RUN:   | FileCheck --check-prefixes=CHECK,R2 %s

# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN:   %p/Inputs/mips-fpic.s -o %t-fpic.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN:   %p/Inputs/mips-fnpic.s -o %t-fnpic.o
# RUN: ld.lld -r %t-fpic.o %t-fnpic.o -o %t-sto-pic-r6.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN:   %p/Inputs/mips-pic.s -o %t-pic-r6.o
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
# RUN:   %s -o %t-npic-r6.o
# RUN: ld.lld %t-npic-r6.o %t-pic-r6.o %t-sto-pic-r6.o \
# RUN:        -script %t.script -o %t-r6.exe
# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t-r6.exe \
# RUN:   | FileCheck --check-prefixes=CHECK,R6 %s

# CHECK:     Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: <__start>:
# CHECK-NEXT:    20100:       jal     {{.*}} <__LA25Thunk_foo1a>
# CHECK-NEXT:                 nop
# CHECK-NEXT:                 jal     {{.*}} <__LA25Thunk_foo2>
# CHECK-NEXT:                 nop
# CHECK-NEXT:                 jal     {{.*}} <__LA25Thunk_foo1b>
# CHECK-NEXT:                 nop
# CHECK-NEXT:                 jal     {{.*}} <__LA25Thunk_foo2>
# CHECK-NEXT:                 nop
# CHECK-NEXT:                 jal     {{.*}} <__LA25Thunk_fpic>
# CHECK-NEXT:                 nop
# CHECK-NEXT:                 jal     {{.*}} <fnpic>
# CHECK-NEXT:                 nop

# CHECK: <__LA25Thunk_fpic>:
# R2:            20130:       lui     $25, 2
# R6:            20130:       aui     $25, $zero, 2
# CHECK-NEXT:                 j       {{.*}} <fpic>
# CHECK-NEXT:                 addiu   $25, $25, 320
# CHECK-NEXT:                 nop

# CHECK: <fpic>:
# CHECK-NEXT:    20140:       nop

# CHECK: <fnpic>:
# CHECK-NEXT:    20150:       nop

# CHECK: <__LA25Thunk_foo1a>:
# R2:            20154:       lui     $25, 2
# R6:            20154:       aui     $25, $zero, 2
# CHECK:                      j       {{.*}} <foo1a>
# CHECK-NEXT:                 addiu   $25, $25, 384
# CHECK-NEXT:                 nop

# CHECK: <__LA25Thunk_foo1b>:
# R2:            20164:       lui     $25, 2
# R6:                         aui     $25, $zero, 2
# CHECK-NEXT:                 j       {{.*}} <foo1b>
# CHECK-NEXT:                 addiu   $25, $25, 388
# CHECK-NEXT:                 nop

# CHECK: <foo1a>:
# CHECK-NEXT:    20180:       nop

# CHECK: <foo1b>:
# CHECK-NEXT:    20184:       nop

# CHECK: <__LA25Thunk_foo2>:
# R2:            20188:       lui     $25, 2
# R6:                         aui     $25, $zero, 2
# CHECK-NEXT:                 j       {{.*}} <foo2>
# CHECK-NEXT:                 addiu   $25, $25, 416
# CHECK-NEXT:                 nop

# CHECK: <foo2>:
# CHECK-NEXT:    201a0:       nop

  .text
  .globl __start
__start:
  jal foo1a
  jal foo2
  jal foo1b
  jal foo2
  jal fpic
  jal fnpic