Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3695922imu; Mon, 28 Jan 2019 09:11:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN5crVfduQpFubvw68ZJulAF7nJpQ6SxKU3YMKQGTIi9Hxe15XuS6DyIYpocdrG2PKIQzxMr X-Received: by 2002:a65:6542:: with SMTP id a2mr20304398pgw.389.1548695515130; Mon, 28 Jan 2019 09:11:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695515; cv=none; d=google.com; s=arc-20160816; b=T7gkvqmIefyxWEmFL2GrOJMjUmUPqL1aGyI5YkUqKiP5xcRWyUKJFUD8y+m6J6BJrQ DENQNoZu60rrjWqSiqNyzLl7LiWXTfEKcKeN3D1Ldsa9cY4peeHOfVlorzS4lSuzncxC 1SLW+YV3UwQwcb8GrhXCezbTNGB9+4DOLXaNcsFQLGr4Nh3DlS3Rzs3K+W06WoLbDv5e EqElQzg9flmkn1jwkwsGphiGIZVuEJ5tEleEYF4b2eaArqvCSuXznvnurGW1RWd+hg1I ZxdC/c1YreIC9i54+eXEIEFU8h2Jergi5H41RSyNLvOx3Aa8lLS/A7e/Qq6h/eISqUke +GRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Kier3m6mKOn+u70iZchyCJE9iGjG9l23CcsYnujS63s=; b=miixeMyCi4vMVHObrIBXHWKOqGre9PhoT3S5p91EogGWMSDk6kzhz1nheWcHnov7Ts hKL7m9vd6k1MuujwUQkslnsPmQ4DXTQ+GqbbDXC4ZkkLzMcZzSUyIuYhR1h7UtE/TmlP 9kF9xGXl7fIV+I81VhUeHw86DvJPeyhqQ+BkUyPxrju3wkgjGh+0XSmAzQ9WW272EmA5 OEGMxjZwYRxKna+COedu47VodsGHGgk8NZgzoyCd64rnhPYcf/k3CFGf3bBkdXeQROgN gqnFct6yjOengixu0hWhKSR/jfRYj0f7wd70pMAsvgErL7ilbAuKJdJ0DG9Hv/HliUnF yvQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1nYws4YA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si29743147pgo.331.2019.01.28.09.11.40; Mon, 28 Jan 2019 09:11:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1nYws4YA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732696AbfA1QJ6 (ORCPT + 99 others); Mon, 28 Jan 2019 11:09:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:35252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731494AbfA1QJ5 (ORCPT ); Mon, 28 Jan 2019 11:09:57 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE6DB2084A; Mon, 28 Jan 2019 16:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691795; bh=/wRSwMFRTZIKctcNWI4xAhYf+T6nkWqJJtL2kD/ChXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1nYws4YABB08B7Q+Br/ksSrXXpZIQxAXTUeGtgaQJqCyk5lPgWQWz888QHO12FxF7 BN2HG+MSrthJiRrWOIsdsA65uC7tGPDICxDkG7Yv6Sov9oeR/JB8PxJkpwDPqERQgt XqP4GSYvdUEfbcSh6KDkOM9d2yIDGdnuuVM5fDd0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stanislav Fomichev , Alexander Shishkin , Mathieu Poirier , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL 4.19 219/258] perf build: Don't unconditionally link the libbfd feature test to -liberty and -lz Date: Mon, 28 Jan 2019 10:58:45 -0500 Message-Id: <20190128155924.51521-219-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanislav Fomichev [ Upstream commit 14541b1e7e723859ff2c75c6fc10cdbbec6b8c34 ] Current libbfd feature test unconditionally links against -liberty and -lz. While it's required on some systems (e.g. opensuse), it's completely unnecessary on the others, where only -lbdf is sufficient (debian). This patch streamlines (and renames) the following feature checks: feature-libbfd - only link against -lbfd (debian), see commit 2cf9040714f3 ("perf tools: Fix bfd dependency libraries detection") feature-libbfd-liberty - link against -lbfd and -liberty feature-libbfd-liberty-z - link against -lbfd, -liberty and -lz (opensuse), see commit 280e7c48c3b8 ("perf tools: fix BFD detection on opensuse") (feature-liberty{,-z} were renamed to feature-libbfd-liberty{,z} for clarity) The main motivation is to fix this feature test for bpftool which is currently broken on debian (libbfd feature shows OFF, but we still unconditionally link against -lbfd and it works). Tested on debian with only -lbfd installed (without -liberty); I'd appreciate if somebody on the other systems can test this new detection method. Signed-off-by: Stanislav Fomichev Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/4dfc634cfcfb236883971b5107cf3c28ec8a31be.1542328222.git.sdf@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/build/Makefile.feature | 4 ++-- tools/build/feature/Makefile | 10 ++++---- tools/perf/Makefile.config | 44 +++++++++++++++++++----------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index f216b2f5c3d7..42a787856cd8 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -79,8 +79,8 @@ FEATURE_TESTS_EXTRA := \ cplus-demangle \ hello \ libbabeltrace \ - liberty \ - liberty-z \ + libbfd-liberty \ + libbfd-liberty-z \ libunwind-debug-frame \ libunwind-debug-frame-arm \ libunwind-debug-frame-aarch64 \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 0516259be70f..bf8a8ebcca1e 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -15,8 +15,8 @@ FILES= \ test-libbfd.bin \ test-disassembler-four-args.bin \ test-reallocarray.bin \ - test-liberty.bin \ - test-liberty-z.bin \ + test-libbfd-liberty.bin \ + test-libbfd-liberty-z.bin \ test-cplus-demangle.bin \ test-libelf.bin \ test-libelf-getphdrnum.bin \ @@ -200,7 +200,7 @@ $(OUTPUT)test-libpython-version.bin: $(BUILD) $(OUTPUT)test-libbfd.bin: - $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl + $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl $(OUTPUT)test-disassembler-four-args.bin: $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes @@ -208,10 +208,10 @@ $(OUTPUT)test-disassembler-four-args.bin: $(OUTPUT)test-reallocarray.bin: $(BUILD) -$(OUTPUT)test-liberty.bin: +$(OUTPUT)test-libbfd-liberty.bin: $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -$(OUTPUT)test-liberty-z.bin: +$(OUTPUT)test-libbfd-liberty-z.bin: $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz $(OUTPUT)test-cplus-demangle.bin: diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index f00ea77f5f08..849b3be15bd8 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -688,18 +688,20 @@ endif ifeq ($(feature-libbfd), 1) EXTLIBS += -lbfd +else + # we are on a system that requires -liberty and (maybe) -lz + # to link against -lbfd; test each case individually here # call all detections now so we get correct # status in VF output - $(call feature_check,liberty) - $(call feature_check,liberty-z) - $(call feature_check,cplus-demangle) + $(call feature_check,libbfd-liberty) + $(call feature_check,libbfd-liberty-z) - ifeq ($(feature-liberty), 1) - EXTLIBS += -liberty + ifeq ($(feature-libbfd-liberty), 1) + EXTLIBS += -lbfd -liberty else - ifeq ($(feature-liberty-z), 1) - EXTLIBS += -liberty -lz + ifeq ($(feature-libbfd-liberty-z), 1) + EXTLIBS += -lbfd -liberty -lz endif endif endif @@ -709,24 +711,24 @@ ifdef NO_DEMANGLE else ifdef HAVE_CPLUS_DEMANGLE_SUPPORT EXTLIBS += -liberty - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else - ifneq ($(feature-libbfd), 1) - ifneq ($(feature-liberty), 1) - ifneq ($(feature-liberty-z), 1) - # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT - # or any of 'bfd iberty z' trinity - ifeq ($(feature-cplus-demangle), 1) - EXTLIBS += -liberty - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT - else - msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) - CFLAGS += -DNO_DEMANGLE - endif - endif + ifeq ($(filter -liberty,$(EXTLIBS)),) + $(call feature_check,cplus-demangle) + + # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT + # or any of 'bfd iberty z' trinity + ifeq ($(feature-cplus-demangle), 1) + EXTLIBS += -liberty + else + msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling) + CFLAGS += -DNO_DEMANGLE endif endif endif + + ifneq ($(filter -liberty,$(EXTLIBS)),) + CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT + endif endif ifneq ($(filter -lbfd,$(EXTLIBS)),) -- 2.19.1