brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 2965daa Raw
71 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly parses and updates the Linux kernel __bug_table4## section.5 6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o7# RUN: %clang %cflags -nostdlib %t.o -o %t.exe \8# RUN:   -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr,--no-pie9 10## Verify bug entry bindings to instructions.11 12# RUN: llvm-bolt %t.exe --print-normalized --print-only=_start -o %t.out \13# RUN:   --eliminate-unreachable=1 --bolt-info=0 | FileCheck %s14 15## Verify bug entry bindings again after unreachable code elimination.16 17# RUN: llvm-bolt %t.out -o %t.out.1 --print-only=_start --print-normalized \18# RUN:   2>&1 | FileCheck --check-prefix=CHECK-REOPT %s19 20# CHECK:      BOLT-INFO: Linux kernel binary detected21# CHECK:      BOLT-INFO: parsed 2 bug table entries22 23  .text24  .globl _start25  .type _start, %function26_start:27  jmp .L128.L0:29  ud230# CHECK:      ud231# CHECK-SAME: BugEntry: 132.L1:33  ud234# CHECK:      ud235# CHECK-SAME: BugEntry: 236 37## Only the second entry should remain after the first pass.38 39# CHECK-REOPT: ud240# CHECK-REOPT-SAME: BugEntry: 241 42  ret43## The return instruction is reachable only via preceding ud2. Test that it is44## treated as a reachable instruction in the Linux kernel mode.45 46# CHECK-REOPT-NEXT: ret47  .size _start, .-_start48 49 50## Bug table.51  .section __bug_table,"a",@progbits521:53  .long .L0 - .  # instruction54  .org 1b + 12552:56  .long .L1 - .  # instruction57  .org 2b + 1258 59## Linux kernel version60  .rodata61  .align 1662  .globl linux_banner63  .type  linux_banner, @object64linux_banner:65  .string  "Linux version 6.6.61\n"66  .size  linux_banner, . - linux_banner67 68## Fake Linux Kernel sections.69  .section __ksymtab,"a",@progbits70  .section __ksymtab_gpl,"a",@progbits71