74 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly parses the Linux kernel exception 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 exception bindings to instructions.10 11# RUN: llvm-bolt %t.exe --print-normalized -o %t.out --keep-nops=0 \12# RUN: --bolt-info=0 | 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 | FileCheck %s17 18# CHECK: BOLT-INFO: Linux kernel binary detected19# CHECK: BOLT-INFO: parsed 2 exception table entries20 21 .text22 .globl _start23 .type _start, %function24_start:25# CHECK: Binary Function "_start"26 nop27.L0:28 mov (%rdi), %rax29# CHECK: mov30# CHECK-SAME: ExceptionEntry: 1 # Fixup: [[FIXUP:[a-zA-Z0-9_]+]]31 nop32.L1:33 mov (%rsi), %rax34# CHECK: mov35# CHECK-SAME: ExceptionEntry: 2 # Fixup: [[FIXUP]]36 nop37 ret38.LF0:39# CHECK: Secondary Entry Point: [[FIXUP]]40 jmp foo41 .size _start, .-_start42 43 .globl foo44 .type foo, %function45foo:46 ret47 .size foo, .-foo48 49 50## Exception table.51 .section __ex_table,"a",@progbits52 .align 453 54 .long .L0 - . # instruction55 .long .LF0 - . # fixup56 .long 0 # data57 58 .long .L1 - . # instruction59 .long .LF0 - . # fixup60 .long 0 # data61 62## Linux kernel version63 .rodata64 .align 1665 .globl linux_banner66 .type linux_banner, @object67linux_banner:68 .string "Linux version 6.6.61\n"69 .size linux_banner, . - linux_banner70 71## Fake Linux Kernel sections.72 .section __ksymtab,"a",@progbits73 .section __ksymtab_gpl,"a",@progbits74