From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161938AbdAJBDQ (ORCPT ); Mon, 9 Jan 2017 20:03:16 -0500 Received: from mga07.intel.com ([134.134.136.100]:30256 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934867AbdAJBCc (ORCPT ); Mon, 9 Jan 2017 20:02:32 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,341,1477983600"; d="scan'208";a="51377446" From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 1/5] perf, tools: Add probing for xed Date: Mon, 9 Jan 2017 17:02:21 -0800 Message-Id: <20170110010225.24870-2-andi@firstfloor.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170110010225.24870-1-andi@firstfloor.org> References: <20170110010225.24870-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen Add autoprobing for the xed disassembler library. Can be downloaded from https://github.com/intelxed/xed v2: Hide. Require XED=1 to enable. Add XED_DIR Signed-off-by: Andi Kleen --- tools/build/Makefile.feature | 8 +++++--- tools/build/feature/Makefile | 8 ++++++-- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-xed.c | 9 +++++++++ tools/perf/Makefile.config | 16 ++++++++++++++++ tools/perf/Makefile.perf | 3 +++ 6 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 tools/build/feature/test-xed.c diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index e3fb5ecbdcb6..971a9ef87ca6 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -63,7 +63,7 @@ FEATURE_TESTS_BASIC := \ lzma \ get_cpuid \ bpf \ - sdt + sdt \ # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list # of all feature tests @@ -74,11 +74,12 @@ FEATURE_TESTS_EXTRA := \ cplus-demangle \ hello \ libbabeltrace \ + xed \ liberty \ liberty-z \ libunwind-debug-frame \ libunwind-debug-frame-arm \ - libunwind-debug-frame-aarch64 + libunwind-debug-frame-aarch64 FEATURE_TESTS ?= $(FEATURE_TESTS_BASIC) @@ -105,7 +106,7 @@ FEATURE_DISPLAY ?= \ zlib \ lzma \ get_cpuid \ - bpf + bpf # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. # If in the future we need per-feature checks/flags for features not @@ -140,6 +141,7 @@ ifeq ($(feature-all), 1) $(call feature_check,compile-x32) $(call feature_check,bionic) $(call feature_check,libbabeltrace) + $(call feature_check,xed) else $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat))) endif diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index b564a2eea039..a1275965c67d 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -48,7 +48,8 @@ FILES= \ test-get_cpuid.bin \ test-sdt.bin \ test-cxx.bin \ - test-jvmti.bin + test-jvmti.bin \ + test-xed.bin FILES := $(addprefix $(OUTPUT),$(FILES)) @@ -68,7 +69,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) ############################### $(OUTPUT)test-all.bin: - $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma + $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lxed $(OUTPUT)test-hello.bin: $(BUILD) @@ -123,6 +124,9 @@ $(OUTPUT)test-numa_num_possible_cpus.bin: $(OUTPUT)test-libunwind.bin: $(BUILD) -lelf +$(OUTPUT)test-xed.bin: + $(BUILD) -lxed + $(OUTPUT)test-libunwind-debug-frame.bin: $(BUILD) -lelf $(OUTPUT)test-libunwind-x86.bin: diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 699e43627397..4a6dd1d1ff49 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -149,6 +149,10 @@ # include "test-sdt.c" #undef main +#define main main_test_xed +# include "test-xed.c" +#endif + int main(int argc, char *argv[]) { main_test_libpython(); @@ -183,6 +187,7 @@ int main(int argc, char *argv[]) main_test_bpf(); main_test_libcrypto(); main_test_sdt(); + main_test_xed(); return 0; } diff --git a/tools/build/feature/test-xed.c b/tools/build/feature/test-xed.c new file mode 100644 index 000000000000..ef9aebf1559d --- /dev/null +++ b/tools/build/feature/test-xed.c @@ -0,0 +1,9 @@ +#include +#include +#include + +int main(void) +{ + xed_tables_init(); + return 0; +} diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 76c84f0eec52..05dfa31506b6 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -682,6 +682,22 @@ ifndef NO_ZLIB endif endif +ifdef XED + ifdef XED_DIR + FEATURE_CHECK_CFLAGS-xed := -I $(XED_DIR)/include + # override for lib64? + FEATURE_CHECK_LDFLAGS-xed := -L $(XED_DIR)/lib -lxed + else + FEATURE_CHECK_CFLAGS-xed := + FEATURE_CHECK_LDFLAGS-xed := -lxed + endif + $(call feature_check,xed) + ifeq ($(feature-xed), 1) + EXTLIBS += -lxed + $(call detected,CONFIG_XED) + endif +endif + ifndef NO_LZMA ifeq ($(feature-lzma), 1) CFLAGS += -DHAVE_LZMA_SUPPORT diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 8f1c258b151a..5f3413050b39 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -84,6 +84,9 @@ include ../scripts/utilities.mak # Define NO_SDT if you do not want to define SDT event in perf tools, # note that it doesn't disable SDT scanning support. # +# Define XED=1 to build WITH the XED disassembler for perf script +# Can also set XED_DIR=/path to set XED directory. +# # Define FEATURES_DUMP to provide features detection dump file # and bypass the feature detection # -- 2.9.3