1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %s -o %t1.o
3// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %p/Inputs/shared.s -o %t2.o
4// RUN: ld.lld -shared -soname=t2.so %t2.o -o %t2.so
5
6// RUN: echo "SECTIONS { \
7// RUN:   .text : { *(.text) } \
8// RUN:   .plt : { *(.plt) } \
9// RUN:   .got.plt : { *(.got.plt) } \
10// RUN:   .dynstr : { *(.dynstr) } \
11// RUN: }" > %t.script
12// RUN: ld.lld %t1.o %t2.so -o %t.exe -z retpolineplt --script %t.script
13// RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
14
15// CHECK:      Disassembly of section .plt:
16// CHECK-EMPTY:
17// CHECK-NEXT: <.plt>:
18// CHECK-NEXT: 10:       pushl   236
19// CHECK-NEXT: 16:       pushl   %eax
20// CHECK-NEXT: 17:       movl    240, %eax
21// CHECK-NEXT: 1c:       calll   0x30 <.plt+0x20>
22// CHECK-NEXT: 21:       pause
23// CHECK-NEXT: 23:       lfence
24// CHECK-NEXT: 26:       jmp     0x21 <.plt+0x11>
25// CHECK-NEXT: 28:       int3
26// CHECK-NEXT: 29:       int3
27// CHECK-NEXT: 2a:       int3
28// CHECK-NEXT: 2b:       int3
29// CHECK-NEXT: 2c:       int3
30// CHECK-NEXT: 2d:       int3
31// CHECK-NEXT: 2e:       int3
32// CHECK-NEXT: 2f:       int3
33// CHECK-NEXT: 30:       movl    %ecx, (%esp)
34// CHECK-NEXT: 33:       movl    4(%esp), %ecx
35// CHECK-NEXT: 37:       movl    %eax, 4(%esp)
36// CHECK-NEXT: 3b:       movl    %ecx, %eax
37// CHECK-NEXT: 3d:       popl    %ecx
38// CHECK-NEXT: 3e:       retl
39// CHECK-NEXT: 3f:       int3
40// CHECK-NEXT: 40:       pushl   %eax
41// CHECK-NEXT: 41:       movl    244, %eax
42// CHECK-NEXT: 46:       calll   0x30 <.plt+0x20>
43// CHECK-NEXT: 4b:       jmp     0x21 <.plt+0x11>
44// CHECK-NEXT: 50:       pushl   $0
45// CHECK-NEXT: 55:       jmp     0x10 <.plt>
46// CHECK-NEXT: 5a:       int3
47// CHECK-NEXT: 5b:       int3
48// CHECK-NEXT: 5c:       int3
49// CHECK-NEXT: 5d:       int3
50// CHECK-NEXT: 5e:       int3
51// CHECK-NEXT: 5f:       int3
52// CHECK-NEXT: 60:       pushl   %eax
53// CHECK-NEXT: 61:       movl    248, %eax
54// CHECK-NEXT: 66:       calll   0x30 <.plt+0x20>
55// CHECK-NEXT: 6b:       jmp     0x21 <.plt+0x11>
56// CHECK-NEXT: 70:       pushl   $8
57// CHECK-NEXT: 75:       jmp     0x10 <.plt>
58// CHECK-NEXT: 7a:       int3
59// CHECK-NEXT: 7b:       int3
60// CHECK-NEXT: 7c:       int3
61// CHECK-NEXT: 7d:       int3
62// CHECK-NEXT: 7e:       int3
63// CHECK-NEXT: 7f:       int3
64
65.global _start
66_start:
67  jmp bar@PLT
68  jmp zed@PLT
69