From patchwork Sat Dec 7 10:17:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 22140 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF80823FD2 for ; Sat, 7 Dec 2013 10:17:57 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id a41sf3661966yho.0 for ; Sat, 07 Dec 2013 02:17:57 -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=cDl9WV2yWPZybUvUORNq9Lcysz2WQB98S1yegQ0/Rwk=; b=DlDh/5Qg26dQKIcg5Ac99oR0zcAW7cu/drLXoVifL6tRsUhJHJ6RTT+wb+4hq7laQ5 P65e/yl9GhZB+DrdCbv3JgZnFPT5OhL2Z/AYBHZMp4t/gI38XjbBPE23aZ9avY496/HV SBsZ28GqU/en4KMQQdmqnPvAL5P31ZZX2MKufdpBnxFPv/0dGJFuxMRi560SeirDFie8 /GAiEax0I2T+WTRnoPEJwZyfw6soL2E4NiZzFpsScGxFDm4zFihWYaAox/b2dE/yCGKx hx2SZu7LWpZfBX6OdNjWkh4xlWbt5i/GtVlKzxrzS3YGcgG+x533b+crzA0nLNlnW6Hw /WlQ== X-Gm-Message-State: ALoCoQl3zVPROZLbZYEkNMFFcxjSlx8fyJeQR/403yQqdyu6espRiGU4sHMP74kL15WrKwMMZBfd X-Received: by 10.236.119.180 with SMTP id n40mr2867964yhh.2.1386411477600; Sat, 07 Dec 2013 02:17:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.162 with SMTP id on2ls1714339qeb.73.gmail; Sat, 07 Dec 2013 02:17:57 -0800 (PST) X-Received: by 10.58.118.36 with SMTP id kj4mr4785235veb.2.1386411477237; Sat, 07 Dec 2013 02:17:57 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id td8si689934vdc.66.2013.12.07.02.17.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Dec 2013 02:17:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id hv10so1770748vcb.8 for ; Sat, 07 Dec 2013 02:17:57 -0800 (PST) X-Received: by 10.52.165.240 with SMTP id zb16mr3956754vdb.19.1386411477047; Sat, 07 Dec 2013 02:17:57 -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 u4csp163450vcz; Sat, 7 Dec 2013 02:17:56 -0800 (PST) X-Received: by 10.15.63.134 with SMTP id m6mr267137eex.74.1386411476066; Sat, 07 Dec 2013 02:17:56 -0800 (PST) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by mx.google.com with ESMTPS id a9si1359850eew.201.2013.12.07.02.17.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Dec 2013 02:17:56 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.182 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=209.85.215.182; Received: by mail-ea0-f182.google.com with SMTP id a15so710244eae.27 for ; Sat, 07 Dec 2013 02:17:55 -0800 (PST) X-Received: by 10.14.95.130 with SMTP id p2mr5751184eef.47.1386411475662; Sat, 07 Dec 2013 02:17:55 -0800 (PST) Received: from localhost.localdomain (240.120-241-81.adsl-dyn.isp.belgacom.be. [81.241.120.240]) by mx.google.com with ESMTPSA id p45sm4985203eeg.1.2013.12.07.02.17.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 07 Dec 2013 02:17:55 -0800 (PST) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, Jiri Olsa , Ingo Molnar , Arnaldo , Will Deacon Cc: patches@linaro.org, Jean Pihet Subject: [PATCH 2/2] perf: unwinding: use the per-feature check flags Date: Sat, 7 Dec 2013 11:17:41 +0100 Message-Id: <1386411461-21510-3-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1386411461-21510-1-git-send-email-jean.pihet@linaro.org> References: <1386411461-21510-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.177 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 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 | 48 +++++++++++++++++-------------- tools/perf/config/feature-checks/Makefile | 8 +++--- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index c551495..cd62286 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -36,6 +36,26 @@ 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) + + 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) +endif + ifeq ($(NO_PERF_REGS),0) CFLAGS += -DHAVE_PERF_REGS_SUPPORT endif @@ -102,7 +122,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)) @@ -310,21 +330,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 @@ -339,14 +345,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 87e7900..0bf3af7 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile @@ -33,12 +33,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 -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 -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) @@ -74,10 +74,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