]> Git Repo - linux.git/commitdiff
tools build: Fix llvm feature detection, still used by bpftool
authorArnaldo Carvalho de Melo <[email protected]>
Thu, 19 Oct 2023 21:09:33 +0000 (18:09 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Fri, 20 Oct 2023 01:33:58 +0000 (22:33 -0300)
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 <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Reviewed-by: Manu Bretelle <[email protected]>
Acked-by: Quentin Monnet <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Anshuman Khandual <[email protected]>
Cc: Carsten Haitzler <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Cc: Fangrui Song <[email protected]>
Cc: He Kuang <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Naveen N. Rao <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Tiezhu Yang <[email protected]>
Cc: Tom Rix <[email protected]>
Cc: Wang Nan <[email protected]>
Cc: Wang ShaoBo <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: Yonghong Song <[email protected]>
Cc: YueHaibing <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/build/feature/test-llvm.cpp [new file with mode: 0644]

diff --git a/tools/build/feature/test-llvm.cpp b/tools/build/feature/test-llvm.cpp
new file mode 100644 (file)
index 0000000..88a3d1b
--- /dev/null
@@ -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;
+}
This page took 0.061523 seconds and 4 git commands to generate.