From patchwork Tue Dec 3 16:09:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 21974 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E8498202DA for ; Tue, 3 Dec 2013 16:10:10 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id v10sf36909097pde.0 for ; Tue, 03 Dec 2013 08:10:08 -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=luK3OWjemsIXQY5N+gATwZRUX28N7Cr3EsQMPp/OhwM=; b=a/4Pvi8p7bRvZxI85jaqqK3zYOd0uDWQkiygUFvD3nGnk9Iet8H6u7tZrW0fUowxOP mKRvyLuN9mmlc+dPH4Ni73Rd7+cDg7XzGcp2S/y8GHQ7udw/fMt+i6wk8mh562UVc+fy tFXhkiScL+lmsVXwRtFC8Ktc2mGsktJAbIUHHr1g3Tv9CmZbDeL0udTl5qVcotFhZRWC 97a+FI67UZjynFchlCig5gdNN2OZgA6IqBlkZxzFRuu4aqfuuKmYnZbFlUcGx8QPgS4m 90tlXH+SxkJbm3E9V5X5quVG/gTwnWTRBpbrGiKHqQ+QwIPcG/eScuo8baAflctCWCgw nV/A== X-Gm-Message-State: ALoCoQly8Kemn8KA63JLgC3QrMB3K/fZYSXhiJKhdCfBDYIs62kSNoxw2jo21MrazXS4zXvFyfUz X-Received: by 10.66.66.35 with SMTP id c3mr23407554pat.12.1386087007514; Tue, 03 Dec 2013 08:10:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.3.165 with SMTP id d5ls4159694qed.77.gmail; Tue, 03 Dec 2013 08:10:07 -0800 (PST) X-Received: by 10.52.230.102 with SMTP id sx6mr47185632vdc.15.1386087007377; Tue, 03 Dec 2013 08:10:07 -0800 (PST) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id gw7si31558241veb.0.2013.12.03.08.10.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:10:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id lc6so10136250vcb.13 for ; Tue, 03 Dec 2013 08:10:07 -0800 (PST) X-Received: by 10.52.227.233 with SMTP id sd9mr174338vdc.53.1386087007104; Tue, 03 Dec 2013 08:10:07 -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 u4csp220185vcz; Tue, 3 Dec 2013 08:10:06 -0800 (PST) X-Received: by 10.14.37.66 with SMTP id x42mr3420475eea.83.1386087006006; Tue, 03 Dec 2013 08:10:06 -0800 (PST) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx.google.com with ESMTPS id u49si3537993eep.232.2013.12.03.08.10.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:10:06 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.54 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=74.125.83.54; Received: by mail-ee0-f54.google.com with SMTP id e51so1633359eek.13 for ; Tue, 03 Dec 2013 08:10:05 -0800 (PST) X-Received: by 10.15.74.200 with SMTP id j48mr16193eey.102.1386087005565; Tue, 03 Dec 2013 08:10:05 -0800 (PST) Received: from localhost.localdomain (218.118-241-81.adsl-dyn.isp.belgacom.be. [81.241.118.218]) by mx.google.com with ESMTPSA id o1sm40627437eea.10.2013.12.03.08.10.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:10:04 -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: Tue, 3 Dec 2013 17:09:46 +0100 Message-Id: <1386086986-30805-3-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1386086986-30805-1-git-send-email-jean.pihet@linaro.org> References: <1386086986-30805-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.182 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 | 6 ++-- 2 files changed, 29 insertions(+), 25 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..8dffb62 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile @@ -38,7 +38,7 @@ BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c ############################### 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