diff options
-rw-r--r-- | tools/build/Makefile.feature | 2 | ||||
-rw-r--r-- | tools/build/feature/Makefile | 9 | ||||
-rw-r--r-- | tools/build/feature/test-llvm-perf.cpp | 14 | ||||
-rw-r--r-- | tools/perf/Makefile.config | 6 |
4 files changed, 27 insertions, 4 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 0717e96d6a0e..427a9389e26c 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -136,7 +136,7 @@ FEATURE_DISPLAY ?= \ libunwind \ libdw-dwarf-unwind \ libcapstone \ - llvm \ + llvm-perf \ zlib \ lzma \ get_cpuid \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 12796808f07a..d6a98b3854f8 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -73,6 +73,7 @@ FILES= \ test-libopencsd.bin \ test-clang.bin \ test-llvm.bin \ + test-llvm-perf.bin \ test-llvm-version.bin \ test-libaio.bin \ test-libzstd.bin \ @@ -388,6 +389,14 @@ $(OUTPUT)test-llvm.bin: $(shell $(LLVM_CONFIG) --system-libs) \ > $(@:.bin=.make.output) 2>&1 +$(OUTPUT)test-llvm-perf.bin: + $(BUILDXX) -std=gnu++17 \ + -I$(shell $(LLVM_CONFIG) --includedir) \ + -L$(shell $(LLVM_CONFIG) --libdir) \ + $(shell $(LLVM_CONFIG) --libs Core BPF) \ + $(shell $(LLVM_CONFIG) --system-libs) \ + > $(@:.bin=.make.output) 2>&1 + $(OUTPUT)test-llvm-version.bin: $(BUILDXX) -std=gnu++17 \ -I$(shell $(LLVM_CONFIG) --includedir) \ diff --git a/tools/build/feature/test-llvm-perf.cpp b/tools/build/feature/test-llvm-perf.cpp new file mode 100644 index 000000000000..a8cbb67e335e --- /dev/null +++ b/tools/build/feature/test-llvm-perf.cpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/raw_ostream.h" + +#if LLVM_VERSION_MAJOR < 13 +# error "Perf requires llvm-devel/llvm-dev version 13 or greater" +#endif + +int main() +{ + llvm::errs() << "Hello World!\n"; + llvm::llvm_shutdown(); + return 0; +} diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 7888c932b1b4..37e3eee2986e 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -981,8 +981,8 @@ ifdef BUILD_NONDISTRO endif ifndef NO_LIBLLVM - $(call feature_check,llvm) - ifeq ($(feature-llvm), 1) + $(call feature_check,llvm-perf) + ifeq ($(feature-llvm-perf), 1) CFLAGS += -DHAVE_LIBLLVM_SUPPORT CFLAGS += $(shell $(LLVM_CONFIG) --cflags) CXXFLAGS += -DHAVE_LIBLLVM_SUPPORT @@ -992,7 +992,7 @@ ifndef NO_LIBLLVM EXTLIBS += -lstdc++ $(call detected,CONFIG_LIBLLVM) else - $(warning No libllvm found, slower source file resolution, please install llvm-devel/llvm-dev) + $(warning No libllvm 13+ found, slower source file resolution, please install llvm-devel/llvm-dev) NO_LIBLLVM := 1 endif endif |