File: ppc64-plt-stub.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 (74 lines) | stat: -rw-r--r-- 2,485 bytes parent folder | download | duplicates (12)
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
# REQUIRES: ppc

# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
# RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
# RUN: ld.lld %t.o %t2.so -o %t
# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s

# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
# RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
# RUN: ld.lld %t.o %t2.so -o %t
# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s

## DT_PLTGOT points to .plt
# SEC: .plt NOBITS 0000000010030400 000400 000018
# SEC: 0x0000000000000003 (PLTGOT) 0x10030400
# SEC: 0x0000000070000000 (PPC64_GLINK) 0x100102e0
# SEC: 0x0000000070000003 (PPC64_OPT) 0x0

## .plt[0] holds the address of _dl_runtime_resolve.
## .plt[1] holds the link map.
## The JMP_SLOT relocation is stored at .plt[2]
# RELOC: 0x10030010 R_PPC64_JMP_SLOT foo 0x0

# CHECK:      <_start>:
# CHECK:      10010298: bl 0x100102b0

# CHECK-LABEL: 00000000100102b0 <__plt_foo>:
# CHECK-NEXT:      std 2, 24(1)
# CHECK-NEXT:      addis 12, 2, 1
# CHECK-NEXT:      ld 12, -32744(12)
# CHECK-NEXT:      mtctr 12
# CHECK-NEXT:      bctr

# CHECK-LABEL: <.glink>:
# CHECK-NEXT:  100102c4: mflr 0
# CHECK-NEXT:            bcl 20, 31, 0x100102cc <.glink+0x8>
# CHECK-NEXT:            mflr 11
# CHECK-NEXT:            mtlr 0
# CHECK-NEXT:            sub     12, 12, 11
# CHECK-NEXT:            addi 0, 12, -52
# CHECK-NEXT:            rldicl 0, 0, 62, 2
# CHECK-NEXT:            ld 12, 44(11)
# CHECK-NEXT:            add 11, 12, 11
# CHECK-NEXT:            ld 12, 0(11)
# CHECK-NEXT:            ld 11, 8(11)
# CHECK-NEXT:            mtctr 12
# CHECK-NEXT:            bctr
# CHECK-NEXT:            <unknown>
# CHECK-NEXT:            <unknown>
## DT_PPC64_GLINK+0x20 = 0x10010300
# CHECK-NEXT:  10010300: b 0x100102c4 <.glink>
# CHECK-NOT:   {{.}}

        .text
        .abiversion 2
        .globl  _start
        .p2align        4
        .type   _start,@function
_start:
.Lfunc_begin0:
.Lfunc_gep0:
  addis 2, 12, .TOC.-.Lfunc_gep0@ha
  addi 2, 2, .TOC.-.Lfunc_gep0@l
.Lfunc_lep0:
  .localentry     _start, .Lfunc_lep0-.Lfunc_gep0
  bl foo
  nop
  li 0, 1
  sc
  .size _start, .-.Lfunc_begin0