1# REQUIRES: system-linux 2 3## Check that BOLT correctly detects the Linux kernel version 4 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-hdr 8# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-A %s 9 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-hdr 13# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-B %s 14 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-hdr 18# RUN: llvm-bolt %t.exe -o %t.out 2>&1 | FileCheck --check-prefix=CHECK-C %s 19 20 .text 21 .globl foo 22 .type foo, %function 23foo: 24 ret 25 .size foo, .-foo 26 27## Linux kernel version 28 .rodata 29 .align 16 30 .globl linux_banner 31 .type linux_banner, @object 32linux_banner: 33 34#ifdef A 35 .string "Linux version 6.6.61\n" 36#endif 37# CHECK-A: BOLT-INFO: Linux kernel version is 6.6.61 38 39#ifdef B 40 .string "Linux version 6.6.50-rc4\n" 41#endif 42# CHECK-B: BOLT-INFO: Linux kernel version is 6.6.50 43 44#ifdef C 45 .string "Linux version 6.6\n" 46#endif 47# CHECK-C: BOLT-INFO: Linux kernel version is 6.6 48 49 .size linux_banner, . - linux_banner 50 51## Fake Linux Kernel sections. 52 .section __ksymtab,"a",@progbits 53 .section __ksymtab_gpl,"a",@progbits 54