From: Arnaldo Carvalho de Melo Date: Thu, 19 Oct 2023 21:09:33 +0000 (-0300) Subject: tools build: Fix llvm feature detection, still used by bpftool X-Git-Tag: v6.6.7~1694^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fa008a2db484024a5cb52676a1b1534dc82330c;p=platform%2Fkernel%2Flinux-starfive.git tools build: Fix llvm feature detection, still used by bpftool When removing the BPF event for perf a feature test that checks if the llvm devel files are availabe was removed but that is also used by bpftool. bpftool uses it to decide what kind of disassembly it will use: llvm or binutils based. Removing the tools/build/feature/test-llvm.cpp file made bpftool to always fallback to binutils disassembly, even with the llvm devel files installed, fix it by restoring just that small test-llvm.cpp test file. Fixes: 56b11a2126bf2f42 ("perf bpf: Remove support for embedding clang for compiling BPF events (-e foo.c)") Reported-by: Manu Bretelle Reviewed-by: Ian Rogers Reviewed-by: Manu Bretelle Acked-by: Quentin Monnet Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Andrii Nakryiko Cc: Anshuman Khandual Cc: Carsten Haitzler Cc: Eduard Zingerman Cc: Fangrui Song Cc: He Kuang Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Kan Liang Cc: Leo Yan Cc: Madhavan Srinivasan Cc: Mark Rutland Cc: Namhyung Kim Cc: Nathan Chancellor Cc: Naveen N. Rao Cc: Nick Desaulniers Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Rob Herring Cc: Tiezhu Yang Cc: Tom Rix Cc: Wang Nan Cc: Wang ShaoBo Cc: Yang Jihong Cc: Yonghong Song Cc: YueHaibing Link: https://lore.kernel.org/lkml/ZTGa0Ukt7QyxWcVy@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/build/feature/test-llvm.cpp b/tools/build/feature/test-llvm.cpp new file mode 100644 index 0000000..88a3d1b --- /dev/null +++ b/tools/build/feature/test-llvm.cpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/raw_ostream.h" +#define NUM_VERSION (((LLVM_VERSION_MAJOR) << 16) + (LLVM_VERSION_MINOR << 8) + LLVM_VERSION_PATCH) + +#if NUM_VERSION < 0x030900 +# error "LLVM version too low" +#endif +int main() +{ + llvm::errs() << "Hello World!\n"; + llvm::llvm_shutdown(); + return 0; +}