kernel_optimize_test/tools/build/feature
Wang Nan a940cad331 perf build: Check LLVM version in feature check
Cancel builtin llvm and clang support when LLVM version is less than
3.9.0: following commits uses newer API.

Since Clang/LLVM's API is not guaranteed to be stable, add a
test-llvm-version.cpp feature checker, issue warning if LLVM found in
compiling environment is not tested yet.

Committer Notes:

Testing it:

Environment:

  $ cat /etc/fedora-release
  Fedora release 25 (Twenty Five)
  $ rpm -q llvm-devel clang-devel
  llvm-devel-3.8.0-1.fc25.x86_64
  clang-devel-3.8.0-2.fc25.x86_64
  $

Before:

  $  make -k LIBCLANGLLVM=1 O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD:   Doing 'make -j4' parallel build
  Warning: tools/include/uapi/linux/bpf.h differs from kernel
  Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel
    INSTALL  GTK UI
    LINK     /tmp/build/perf/perf
  /tmp/build/perf/libperf.a(libperf-in.o): In function `perf::createCompilerInvocation(llvm::SmallVector<char const*, 16u>, llvm::StringRef&, clang::DiagnosticsEngine&)':
  /home/acme/git/linux/tools/perf/util/c++/clang.cpp:56: undefined reference to `clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector<char const*, 16u> const&)'
  /tmp/build/perf/libperf.a(libperf-in.o): In function `perf::getModuleFromSource(llvm::SmallVector<char const*, 16u>, llvm::StringRef, llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem>)':
  /home/acme/git/linux/tools/perf/util/c++/clang.cpp:68: undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, bool)'
  /home/acme/git/linux/tools/perf/util/c++/clang.cpp:69: undefined reference to `clang::CompilerInstance::createDiagnostics(clang::DiagnosticConsumer*, bool)'
  <SNIP>

After:

  Makefile.config:807: No suitable libLLVM found, disabling builtin clang and llvm support. Please install llvm-dev(el) (>= 3.9.0)

Updating the environment to a locally built LLVM 4.0 + clang 3.9 (forgot
to git pull, duh) combo, all works as expected, it is properly detected
and built into the resulting perf binary.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Joe Stringer <joe@ovn.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/20161206072230.7651-1-wangnan0@huawei.com
[ Change the warning message a bit (add 'suitable' and 'builtin'), clarifying it, see committer notes above ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-12-06 13:21:55 -03:00
..
.gitignore
Makefile perf build: Check LLVM version in feature check 2016-12-06 13:21:55 -03:00
test-all.c perf build: Add sdt feature detection 2016-07-13 23:09:09 -03:00
test-backtrace.c
test-bionic.c
test-bpf.c bpf tools: Fix syscall argument 2016-04-28 09:58:57 -03:00
test-clang.cpp tools build: Add feature detection for clang 2016-12-05 15:51:43 -03:00
test-compile.c tools build: Check basic headers for test-compile feature checker 2016-01-27 11:59:32 -03:00
test-cplus-demangle.c
test-cxx.cpp tools build: Add feature detection for g++ 2016-10-05 19:59:35 -03:00
test-dwarf_getlocations.c perf probe: Check if dwarf_getlocations() is available 2016-04-06 10:44:28 -03:00
test-dwarf.c
test-fortify-source.c
test-get_cpuid.c tools build: Add test for presence of __get_cpuid() gcc builtin 2015-09-17 13:14:35 -03:00
test-glibc.c perf tools: Fix build errors with mipsel-linux-uclibc compiler 2015-08-05 16:56:16 -03:00
test-gtk2-infobar.c
test-gtk2.c
test-hello.c
test-jvmti.c tools build: Add jvmti feature detection support 2016-11-14 12:40:32 -03:00
test-libaudit.c
test-libbabeltrace.c
test-libbfd.c
test-libcrypto.c perf build: Add libcrypto feature detection 2016-02-05 09:46:45 -03:00
test-libdw-dwarf-unwind.c
test-libelf-gelf_getnote.c perf tools: Add feature detection for gelf_getnote() 2016-07-12 15:20:41 -03:00
test-libelf-getphdrnum.c
test-libelf-getshdrstrndx.c perf build: Add feature detection for libelf's elf_getshdrstrndx() 2016-07-04 19:38:59 -03:00
test-libelf-mmap.c
test-libelf.c
test-libnuma.c
test-libperl.c
test-libpython-version.c
test-libpython.c
test-libslang.c
test-libunwind-aarch64.c perf build: Add build-test for libunwind cross-platforms support 2016-05-11 12:24:58 -03:00
test-libunwind-arm.c perf build: Add build-test for libunwind cross-platforms support 2016-05-11 12:24:58 -03:00
test-libunwind-debug-frame-aarch64.c perf build: Add build-test for debug-frame on arm/arm64 2016-05-11 12:24:58 -03:00
test-libunwind-debug-frame-arm.c perf build: Add build-test for debug-frame on arm/arm64 2016-05-11 12:24:58 -03:00
test-libunwind-debug-frame.c
test-libunwind-x86_64.c perf build: Add build-test for libunwind cross-platforms support 2016-05-11 12:24:58 -03:00
test-libunwind-x86.c perf build: Add build-test for libunwind cross-platforms support 2016-05-11 12:24:58 -03:00
test-libunwind.c
test-llvm-version.cpp perf build: Check LLVM version in feature check 2016-12-06 13:21:55 -03:00
test-llvm.cpp perf build: Check LLVM version in feature check 2016-12-06 13:21:55 -03:00
test-lzma.c
test-numa_num_possible_cpus.c tools build: Add test for presence of numa_num_possible_cpus() in libnuma 2015-09-17 13:14:35 -03:00
test-pthread-attr-setaffinity-np.c
test-sdt.c perf build: Add sdt feature detection 2016-07-13 23:09:09 -03:00
test-stackprotector-all.c
test-sync-compare-and-swap.c
test-timerfd.c
test-zlib.c