From patchwork Tue Dec 10 12:24:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 22207 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2364C23908 for ; Tue, 10 Dec 2013 12:24:26 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id uo5sf23817160pbc.2 for ; Tue, 10 Dec 2013 04:24:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=RHNumImxkgk1hEwHfDoa+uC+bedfkOCJaz42EjrcsQ4=; b=aTQAHvAfIhXEiSdr36Z+GN7ZfMnVyrL3SNw4CD3tHcfYrHVsjlHpUoNoazr80gihay V0BFlkOB1xHtjOuQW/+P9EvpqrDnC1ZJTKhLgAy04TIheBUVYwGTNhpBFBfPYrx9hkk1 2WpBlaQgIQwO7wTikbyGR4OK067lEg+Jiw4Da8ti0+zuttPkmHJzXEfXHYRcLa8MCtwF dr/Gt00n46Hivkp1+xe+ALCIqNi+2ABa8yR2DJPxGHV5duQNNGY2y3rzhn/pX3R/YvS0 mfK+lCedUcAI7NglQtfwR7VADtHYp6YiLYI1qckHl1674zwFlauMP0FTj6pLMybeGgPm 7Uyw== X-Gm-Message-State: ALoCoQnRFaqVR0xnfTsQwbx3gHPpSRbUsS7fBZ9SJ8rNR8ENC332vm35TwuJZcsHY7oebK1T8/Yl X-Received: by 10.66.190.197 with SMTP id gs5mr13183842pac.14.1386678265283; Tue, 10 Dec 2013 04:24:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.16.35 with SMTP id c3ls2388982qed.83.gmail; Tue, 10 Dec 2013 04:24:25 -0800 (PST) X-Received: by 10.220.174.200 with SMTP id u8mr13664084vcz.6.1386678265160; Tue, 10 Dec 2013 04:24:25 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id gw7si5089379veb.114.2013.12.10.04.24.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 04:24:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ks9so4529610vcb.12 for ; Tue, 10 Dec 2013 04:24:25 -0800 (PST) X-Received: by 10.52.120.11 with SMTP id ky11mr502833vdb.28.1386678265065; Tue, 10 Dec 2013 04:24:25 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp183671vcz; Tue, 10 Dec 2013 04:24:24 -0800 (PST) X-Received: by 10.15.74.200 with SMTP id j48mr8048682eey.102.1386678263414; Tue, 10 Dec 2013 04:24:23 -0800 (PST) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by mx.google.com with ESMTPS id f8si14068664eep.36.2013.12.10.04.24.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 04:24:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=209.85.215.176; Received: by mail-ea0-f176.google.com with SMTP id h14so2187002eaj.35 for ; Tue, 10 Dec 2013 04:24:22 -0800 (PST) X-Received: by 10.15.42.205 with SMTP id u53mr140221eev.113.1386678262539; Tue, 10 Dec 2013 04:24:22 -0800 (PST) Received: from localhost.localdomain (75.113-241-81.adsl-dyn.isp.belgacom.be. [81.241.113.75]) by mx.google.com with ESMTPSA id l4sm40612051een.13.2013.12.10.04.24.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 10 Dec 2013 04:24:21 -0800 (PST) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, Jiri Olsa , Ingo Molnar , Arnaldo Cc: patches@linaro.org, Will Deacon , Jean Pihet Subject: [PATCH 2/2] perf: unwinding: use the per-feature check flags Date: Tue, 10 Dec 2013 13:24:04 +0100 Message-Id: <1386678244-13535-3-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1386678244-13535-1-git-send-email-jean.pihet@linaro.org> References: <1386678244-13535-1-git-send-email-jean.pihet@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jean.pihet@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use the per-feature check flags for the unwinding feature in order to correctly compile the test-all, libunwind and libunwind-debug-frame feature checks. Tested on x86_64, ARMv7 and ARMv8 with and without LIBUNWIND_DIR set in 'make -C tools/perf' Signed-off-by: Jean Pihet Cc: Jiri Olsa --- tools/perf/config/Makefile | 52 ++++++++++++++++++------------- tools/perf/config/feature-checks/Makefile | 8 ++--- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 2afb132..5a1f4df 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -36,6 +36,30 @@ ifeq ($(ARCH),arm) LIBUNWIND_LIBS = -lunwind -lunwind-arm endif +ifeq ($(LIBUNWIND_LIBS),) + NO_LIBUNWIND := 1 +else + # + # For linking with debug library, run like: + # + # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ + # + ifdef LIBUNWIND_DIR + LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include + LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib + endif + LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS) + + # Set per-feature check compilation flags + FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS) + FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) + FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) + FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) + # and the flags for the test-all case + FEATURE_CHECK_CFLAGS-all += $(LIBUNWIND_CFLAGS) + FEATURE_CHECK_LDFLAGS-all += $(LIBUNWIND_LDFLAGS) +endif + ifeq ($(NO_PERF_REGS),0) CFLAGS += -DHAVE_PERF_REGS_SUPPORT endif @@ -102,7 +126,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code)) @@ -305,21 +329,7 @@ ifndef NO_LIBELF endif # NO_DWARF endif # NO_LIBELF -ifeq ($(LIBUNWIND_LIBS),) - NO_LIBUNWIND := 1 -endif - ifndef NO_LIBUNWIND - # - # For linking with debug library, run like: - # - # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ - # - ifdef LIBUNWIND_DIR - LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include - LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib - endif - ifneq ($(feature-libunwind), 1) msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1); NO_LIBUNWIND := 1 @@ -334,14 +344,12 @@ ifndef NO_LIBUNWIND # non-ARM has no dwarf_find_debug_frame() function: CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME endif - endif -endif -ifndef NO_LIBUNWIND - CFLAGS += -DHAVE_LIBUNWIND_SUPPORT - EXTLIBS += $(LIBUNWIND_LIBS) - CFLAGS += $(LIBUNWIND_CFLAGS) - LDFLAGS += $(LIBUNWIND_LDFLAGS) + CFLAGS += -DHAVE_LIBUNWIND_SUPPORT + EXTLIBS += $(LIBUNWIND_LIBS) + CFLAGS += $(LIBUNWIND_CFLAGS) + LDFLAGS += $(LIBUNWIND_LDFLAGS) + endif # ifneq ($(feature-libunwind), 1) endif ifndef NO_LIBAUDIT diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index b8bb749..bc86462 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile @@ -32,12 +32,12 @@ CC := $(CC) -MD all: $(FILES) -BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c +BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $@.c $(LDFLAGS) ############################### test-all: - $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -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 + $(BUILD) -Werror -fstack-protector-all -O2 -Werror -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 test-hello: $(BUILD) @@ -70,10 +70,10 @@ test-libnuma: $(BUILD) -lnuma test-libunwind: - $(BUILD) $(LIBUNWIND_LIBS) -lelf + $(BUILD) -lelf test-libunwind-debug-frame: - $(BUILD) $(LIBUNWIND_LIBS) -lelf + $(BUILD) -lelf test-libaudit: $(BUILD) -laudit