Check for kconfig.h presence, not just build dir (#3588)
authorWGH <wgh@torlan.ru>
Tue, 14 Sep 2021 01:00:23 +0000 (04:00 +0300)
committerGitHub <noreply@github.com>
Tue, 14 Sep 2021 01:00:23 +0000 (18:00 -0700)
commit291ec6e99a103953806aa9bf09f18461e3a9e83b
tree7e9cdc2d0ed550f747f13a82f053cde4611b80bc
parentf458c3535b5d56b9e0f2841d4f42ba6951aa30bc
Check for kconfig.h presence, not just build dir (#3588)

This is a better check than just checking the presence of the build dir.

In Gentoo Linux, when you remove the kernel source package, the leftover
build directory is intentionally left in place. Which means the
/lib/modules/$(uname -r)/build symlink still remains valid, but there's
no kconfig.h there anymore[1]. This prevents bcc from using the kheaders
(/sys/kernel/kheaders.tar.xz) fallback, instead making it fail later on:

    <built-in>:1:10: fatal error: './include/linux/kconfig.h' file not found
    #include "./include/linux/kconfig.h"
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

[1] https://bugs.gentoo.org/809347

Signed-off-by: WGH <wgh@torlan.ru>
src/cc/frontends/clang/loader.cc