1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux -position-independent %s -o %t1.o 3// RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux -position-independent %p/Inputs/shared.s -o %t2.o 4// RUN: ld.lld -shared %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 -pie --script %t.script 13// RUN: llvm-objdump -d -s %t.exe | FileCheck %s 14 15// CHECK: Disassembly of section .plt: 16// CHECK-EMPTY: 17// CHECK-NEXT: <.plt>: 18// CHECK-NEXT: 10: ff b3 04 00 00 00 pushl 4(%ebx) 19// CHECK-NEXT: 16: 50 pushl %eax 20// CHECK-NEXT: 17: 8b 83 08 00 00 00 movl 8(%ebx), %eax 21// CHECK-NEXT: 1d: e8 0e 00 00 00 calll 0x30 <.plt+0x20> 22// CHECK-NEXT: 22: f3 90 pause 23// CHECK-NEXT: 24: 0f ae e8 lfence 24// CHECK-NEXT: 27: eb f9 jmp 0x22 <.plt+0x12> 25// CHECK-NEXT: 29: cc int3 26// CHECK-NEXT: 2a: cc int3 27// CHECK-NEXT: 2b: cc int3 28// CHECK-NEXT: 2c: cc int3 29// CHECK-NEXT: 2d: cc int3 30// CHECK-NEXT: 2e: cc int3 31// CHECK-NEXT: 2f: cc int3 32// CHECK-NEXT: 30: 89 0c 24 movl %ecx, (%esp) 33// CHECK-NEXT: 33: 8b 4c 24 04 movl 4(%esp), %ecx 34// CHECK-NEXT: 37: 89 44 24 04 movl %eax, 4(%esp) 35// CHECK-NEXT: 3b: 89 c8 movl %ecx, %eax 36// CHECK-NEXT: 3d: 59 popl %ecx 37// CHECK-NEXT: 3e: c3 retl 38// CHECK-NEXT: 3f: cc int3 39// CHECK-NEXT: 40: 50 pushl %eax 40// CHECK-NEXT: 41: 8b 83 0c 00 00 00 movl 12(%ebx), %eax 41// CHECK-NEXT: 47: e8 e4 ff ff ff calll 0x30 <.plt+0x20> 42// CHECK-NEXT: 4c: e9 d1 ff ff ff jmp 0x22 <.plt+0x12> 43// CHECK-NEXT: 51: 68 00 00 00 00 pushl $0 44// CHECK-NEXT: 56: e9 b5 ff ff ff jmp 0x10 <.plt> 45// CHECK-NEXT: 5b: cc int3 46// CHECK-NEXT: 5c: cc int3 47// CHECK-NEXT: 5d: cc int3 48// CHECK-NEXT: 5e: cc int3 49// CHECK-NEXT: 5f: cc int3 50// CHECK-NEXT: 60: 50 pushl %eax 51// CHECK-NEXT: 61: 8b 83 10 00 00 00 movl 16(%ebx), %eax 52// CHECK-NEXT: 67: e8 c4 ff ff ff calll 0x30 <.plt+0x20> 53// CHECK-NEXT: 6c: e9 b1 ff ff ff jmp 0x22 <.plt+0x12> 54// CHECK-NEXT: 71: 68 08 00 00 00 pushl $8 55// CHECK-NEXT: 76: e9 95 ff ff ff jmp 0x10 <.plt> 56// CHECK-NEXT: 7b: cc int3 57// CHECK-NEXT: 7c: cc int3 58// CHECK-NEXT: 7d: cc int3 59// CHECK-NEXT: 7e: cc int3 60// CHECK-NEXT: 7f: cc int3 61 62.global _start 63_start: 64 jmp bar@PLT 65 jmp zed@PLT 66