From d58ac0bf8d1e6ffbfcb0a77e459cf4737b131b75 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Sat, 26 Nov 2016 07:03:33 +0000 Subject: perf build: Add clang and llvm compile and linking support Add necessary c++ flags and link libraries to support builtin clang and LLVM. Add all llvm and clang libraries, so don't need to worry about clang changes its libraries setting. However, linking perf would take much longer than usual. Signed-off-by: Wang Nan Cc: Alexei Starovoitov Cc: He Kuang Cc: Jiri Olsa Cc: Joe Stringer Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/20161126070354.141764-10-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Makefile.config | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tools/perf/Makefile.config') diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 8a493d46fab9..b7c9c8051a33 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -136,6 +136,7 @@ endif # Treat warnings as errors unless directed not to ifneq ($(WERROR),0) CFLAGS += -Werror + CXXFLAGS += -Werror endif ifndef DEBUG @@ -182,6 +183,13 @@ CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -std=gnu99 +CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti +CXXFLAGS += -Wall +CXXFLAGS += -fno-omit-frame-pointer +CXXFLAGS += -ggdb3 +CXXFLAGS += -funwind-tables +CXXFLAGS += -Wno-strict-aliasing + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstack @@ -783,6 +791,33 @@ ifndef NO_JVMTI endif endif +USE_CXX = 0 +USE_CLANGLLVM = 0 +ifdef LIBCLANGLLVM + $(call feature_check,cxx) + ifneq ($(feature-cxx), 1) + msg := $(warning No g++ found, disable clang and llvm support. Please install g++) + else + $(call feature_check,llvm) + ifneq ($(feature-llvm), 1) + msg := $(warning No libLLVM found, disable clang and llvm support. Please install llvm-dev) + else + $(call feature_check,clang) + ifneq ($(feature-clang), 1) + msg := $(warning No libclang found, disable clang and llvm support. Please install libclang-dev) + else + CFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT + CXXFLAGS += -DHAVE_LIBCLANGLLVM_SUPPORT -I$(shell $(LLVM_CONFIG) --includedir) + $(call detected,CONFIG_CXX) + $(call detected,CONFIG_CLANGLLVM) + USE_CXX = 1 + USE_LLVM = 1 + USE_CLANG = 1 + endif + endif + endif +endif + # Among the variables below, these: # perfexecdir # template_dir -- cgit v1.2.3