69 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly updates the Linux kernel static calls table.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-hdr8 9## Verify static calls bindings to instructions.10 11# RUN: llvm-bolt %t.exe --print-normalized -o %t.out --keep-nops=0 \12# RUN: --bolt-info=0 2>&1 | FileCheck %s13 14## Verify the bindings again on the rewritten binary with nops removed.15 16# RUN: llvm-bolt %t.out -o %t.out.1 --print-normalized 2>&1 | FileCheck %s17 18# CHECK: BOLT-INFO: Linux kernel binary detected19# CHECK: BOLT-INFO: parsed 2 static call entries20 21 .text22 .globl _start23 .type _start, %function24_start:25# CHECK: Binary Function "_start"26 nop27.L0:28 call foo29# CHECK: callq foo # {{.*}} StaticCall: 130 nop31.L1:32 jmp foo33# CHECK: jmp foo # {{.*}} StaticCall: 234 .size _start, .-_start35 36 .globl foo37 .type foo, %function38foo:39 ret40 .size foo, .-foo41 42 43## Static call table.44 .rodata45 .globl __start_static_call_sites46 .type __start_static_call_sites, %object47__start_static_call_sites:48 .long .L0 - .49 .long 050 .long .L1 - .51 .long 052 53 .globl __stop_static_call_sites54 .type __stop_static_call_sites, %object55__stop_static_call_sites:56 57## Linux kernel version58 .rodata59 .align 1660 .globl linux_banner61 .type linux_banner, @object62linux_banner:63 .string "Linux version 6.6.61\n"64 .size linux_banner, . - linux_banner65 66## Fake Linux Kernel sections.67 .section __ksymtab,"a",@progbits68 .section __ksymtab_gpl,"a",@progbits69