65 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT correctly detects the Linux kernel version4 5# RUN: %clang -DA -target x86_64-unknown-unknown \6# RUN: %cflags -nostdlib %s -o %t.exe \7# RUN: -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr8# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-A %s9 10# RUN: %clang -DB -target x86_64-unknown-unknown \11# RUN: %cflags -nostdlib %s -o %t.exe \12# RUN: -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr13# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-B %s14 15# RUN: %clang -DC -target x86_64-unknown-unknown \16# RUN: %cflags -nostdlib %s -o %t.exe \17# RUN: -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr18# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-C %s19 20# RUN: %clang -DD -target x86_64-unknown-unknown \21# RUN: %cflags -nostdlib %s -o %t.exe \22# RUN: -Wl,--image-base=0xffffffff80000000,--no-dynamic-linker,--no-eh-frame-hdr23# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-D %s24 25 .text26 .globl foo27 .type foo, %function28foo:29 ret30 .size foo, .-foo31 32## Linux kernel version33 .rodata34 .align 1635 .globl linux_banner36 .type linux_banner, @object37linux_banner:38 39#ifdef A40 .string "Linux version 6.6.61\n"41#endif42# CHECK-A: BOLT-INFO: Linux kernel version is 6.6.6143 44#ifdef B45 .string "Linux version 6.6.50-rc4\n"46#endif47# CHECK-B: BOLT-INFO: Linux kernel version is 6.6.5048 49#ifdef C50 .string "Linux version 6.6\n"51#endif52# CHECK-C: BOLT-INFO: Linux kernel version is 6.653 54#ifdef D55 .hidden linux_banner56 .string "Linux version 6.6.15.2-2-xxx\n"57#endif58# CHECK-D: BOLT-INFO: Linux kernel version is 6.659 60 .size linux_banner, . - linux_banner61 62## Fake Linux Kernel sections.63 .section __ksymtab,"a",@progbits64 .section __ksymtab_gpl,"a",@progbits65