tools build: Fix llvm feature detection, still used by bpftool
PATCH 1/1 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.
--- tools/build/feature/test-llvm.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/build/feature/test-llvm.cpp
tools/build/feature/test-llvm.cpp new file +14 -0
@@ -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; +}
Signature · 1 line
2.41.0
Quoted 41 lines · Arnaldo Carvalho de Melo
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.cppfile 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]>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 Ian Rogers <[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 Quentin Monnet <[email protected]>Cc Ravi Bangoria <[email protected]>Cc Rob Herring <[email protected]>Cc Tiezhu Yang <[email protected]>
Quoted 8 lines
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]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Sorry for the breakage.
Thanks,
Ian
Quoted 28 lines
--- tools/build/feature/test-llvm.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/build/feature/test-llvm.cpptools/build/feature/test-llvm.cpp new file +14
-1@@ -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; +} --2.41.0
Quoted 63 lines · Arnaldo Carvalho de Melo
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.cppfile 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]>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 Ian Rogers <[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 Quentin Monnet <[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]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>--- tools/build/feature/test-llvm.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/build/feature/test-llvm.cpptools/build/feature/test-llvm.cpp new file +4
-0@@ -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)
tools/build/feature/test-llvm.cpp line 14
Quoted 10 lines
tools/build/feature/test-llvm.cpp new file +10
-0+ +#if NUM_VERSION < 0x030900 +# error "LLVM version too low" +#endif +int main() +{ + llvm::errs() << "Hello World!\n"; + llvm::llvm_shutdown(); + return 0; +}
Thanks Arnaldo, Manu!
Quoted 5 lines · Arnaldo Carvalho de Melo
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.
Quoted 8 lines
bpftool uses it to decide what kind of disassembly it will use: llvm or binutils based.
Removing the
tools/build/feature/test-llvm.cppfile 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)")
Should we route this through the bpf-next tree to get the fix for bpftool into Github mirror ASAP?
Quoted 64 lines
Reported-by Manu Bretelle <[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 Ian Rogers <[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 Quentin Monnet <[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]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>--- tools/build/feature/test-llvm.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/build/feature/test-llvm.cpptools/build/feature/test-llvm.cpp new file +14
-1@@ -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; +} --2.41.0
Quoted 10 lines · Andrii Nakryiko
Quoted 8 lines · Arnaldo Carvalho de Melo
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.
Quoted 8 lines
Quoted 5 lines
Removing the
tools/build/feature/test-llvm.cppfile 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)")Should we route this through the bpf-next tree to get the fix for bpftool into Github mirror ASAP?
It shouldn't be necessary. The GitHub mirror for bpftool uses its own feature detection mechanism, and is not affected here. This patch won't even make it to the mirror.
Quentin
Quoted 63 lines · Arnaldo Carvalho de Melo
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.cppfile 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]>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 Ian Rogers <[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 Quentin Monnet <[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]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>--- tools/build/feature/test-llvm.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/build/feature/test-llvm.cpptools/build/feature/test-llvm.cpp new file +4
-0@@ -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)
tools/build/feature/test-llvm.cpp line 14
Quoted 10 lines
tools/build/feature/test-llvm.cpp new file +10
-0+ +#if NUM_VERSION < 0x030900 +# error "LLVM version too low" +#endif +int main() +{ + llvm::errs() << "Hello World!\n"; + llvm::llvm_shutdown(); + return 0; +}
Thanks for the quick turnaround!