File: i386-retpoline-nopic-linkerscript.s

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (68 lines) | stat: -rw-r--r-- 2,379 bytes parent folder | download | duplicates (9)
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
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %s -o %t1.o
// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %p/Inputs/shared.s -o %t2.o
// RUN: ld.lld -shared -soname=t2.so %t2.o -o %t2.so

// RUN: echo "SECTIONS { \
// RUN:   .text : { *(.text) } \
// RUN:   .plt : { *(.plt) } \
// RUN:   .got.plt : { *(.got.plt) } \
// RUN:   .dynstr : { *(.dynstr) } \
// RUN: }" > %t.script
// RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt --script %t.script
// RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s

// CHECK:      Disassembly of section .plt:
// CHECK-EMPTY:
// CHECK-NEXT: <.plt>:
// CHECK-NEXT: 10:       pushl   236
// CHECK-NEXT: 16:       pushl   %eax
// CHECK-NEXT: 17:       movl    240, %eax
// CHECK-NEXT: 1c:       calll   0x30 <.plt+0x20>
// CHECK-NEXT: 21:       pause
// CHECK-NEXT: 23:       lfence
// CHECK-NEXT: 26:       jmp     0x21 <.plt+0x11>
// CHECK-NEXT: 28:       int3
// CHECK-NEXT: 29:       int3
// CHECK-NEXT: 2a:       int3
// CHECK-NEXT: 2b:       int3
// CHECK-NEXT: 2c:       int3
// CHECK-NEXT: 2d:       int3
// CHECK-NEXT: 2e:       int3
// CHECK-NEXT: 2f:       int3
// CHECK-NEXT: 30:       movl    %ecx, (%esp)
// CHECK-NEXT: 33:       movl    4(%esp), %ecx
// CHECK-NEXT: 37:       movl    %eax, 4(%esp)
// CHECK-NEXT: 3b:       movl    %ecx, %eax
// CHECK-NEXT: 3d:       popl    %ecx
// CHECK-NEXT: 3e:       retl
// CHECK-NEXT: 3f:       int3
// CHECK-NEXT: 40:       pushl   %eax
// CHECK-NEXT: 41:       movl    244, %eax
// CHECK-NEXT: 46:       calll   0x30 <.plt+0x20>
// CHECK-NEXT: 4b:       jmp     0x21 <.plt+0x11>
// CHECK-NEXT: 50:       pushl   $0
// CHECK-NEXT: 55:       jmp     0x10 <.plt>
// CHECK-NEXT: 5a:       int3
// CHECK-NEXT: 5b:       int3
// CHECK-NEXT: 5c:       int3
// CHECK-NEXT: 5d:       int3
// CHECK-NEXT: 5e:       int3
// CHECK-NEXT: 5f:       int3
// CHECK-NEXT: 60:       pushl   %eax
// CHECK-NEXT: 61:       movl    248, %eax
// CHECK-NEXT: 66:       calll   0x30 <.plt+0x20>
// CHECK-NEXT: 6b:       jmp     0x21 <.plt+0x11>
// CHECK-NEXT: 70:       pushl   $8
// CHECK-NEXT: 75:       jmp     0x10 <.plt>
// CHECK-NEXT: 7a:       int3
// CHECK-NEXT: 7b:       int3
// CHECK-NEXT: 7c:       int3
// CHECK-NEXT: 7d:       int3
// CHECK-NEXT: 7e:       int3
// CHECK-NEXT: 7f:       int3

.global _start
_start:
  jmp bar@PLT
  jmp zed@PLT