64 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly parses the Linux kernel .parainstructions section.4 5# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o6# RUN: %clang %cflags -nostdlib %t.o -o %t.exe \7# RUN: -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr,--no-pie8 9## Verify paravirtual bindings to instructions.10 11# RUN: llvm-bolt %t.exe --print-normalized -o %t.out --keep-nops=0 | FileCheck %s12 13# CHECK: BOLT-INFO: Linux kernel binary detected14# CHECK: BOLT-INFO: parsed 2 paravirtual patch sites15 16 .rodata17fptr:18 .quad 019 20 .text21 .globl _start22 .type _start, %function23_start:24# CHECK: Binary Function "_start"25 nop26.L1:27 call *fptr(%rip)28# CHECK: call29# CHECK-SAME: ParaSite: 130 nop31.L2:32 call *fptr(%rip)33# CHECK: call34# CHECK-SAME: ParaSite: 235 ret36 .size _start, .-_start37 38 39## Paravirtual patch sites.40 .section .parainstructions,"a",@progbits41 42 .balign 843 .quad .L1 # instruction44 .byte 1 # type45 .byte 7 # length46 47 .balign 848 .quad .L2 # instruction49 .byte 1 # type50 .byte 7 # length51 52## Linux kernel version53 .rodata54 .align 1655 .globl linux_banner56 .type linux_banner, @object57linux_banner:58 .string "Linux version 6.6.61\n"59 .size linux_banner, . - linux_banner60 61## Fake Linux Kernel sections.62 .section __ksymtab,"a",@progbits63 .section __ksymtab_gpl,"a",@progbits64