Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2750775imj; Mon, 11 Feb 2019 07:57:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IaQWnGoZC4gfLXRzk3v315SHPMyruGikFVSIFGktDLYmtcItw7J3XFWdMsmqHxiLHHN1YFp X-Received: by 2002:a63:2686:: with SMTP id m128mr7641318pgm.355.1549900659053; Mon, 11 Feb 2019 07:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900659; cv=none; d=google.com; s=arc-20160816; b=SFU/Eg8Ps2IsnD3hn8ZnQBR8qaSZxzWq0rpDrW289BnGRYNr85gcMw1xZYCZhg5SkV JxuvASPbdr8X/85qO3B5xvXSxKwJUXHuo+97VSgGR1c/yTt8kBNQWIn9mkoQLwkXtlar XAlkEQx5upgXGWPDRFrldj8sqrWEzyDslxBSIlArTQYBXD/8G9/2wjebthDcb2ZiUuwS PBhbecaNBTJE62h8lvxduLoJG82XQNszwpD9TSwPorRPbYJouyNLcw/CJTjljJYt2wK+ 28rRyao+WETZYLEd/sZojhseb3AZIZlQ/9iJOxTwFENMNpQipS7ABmnbymC8zRoxM75s k9PA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=40tagChVqeI7sfIYwBOZa4SxvAfGjxfluApLjO5pg58=; b=MDqmZc9bP7QMtzLOSpYNZPh1rzzjU69KyOsmK9jXSdY7CT36K1E33+DX9VnHWgSkm3 wW7mj6Y4/GDXMB4n4wYMF3dtr0Ha1Sf7F6dz1HKzvqAw0eRu7o/gKOE8kJA3eHhCAQse EPwy7DlsOpixJkhMe1UOdf/YJNUscEA2A3MqQ+KAvXFStOXKPqXXB4rrnwZxQYULMqZD yNlW31A5qbcX3eTi6qlbP2edrGoe2DLS558m36p6elcUXrWhOCMhBgE2zZZ09PefEViJ eF9A4Ize7bSdENBUipA17fSkJfiIQU5XoBJwowb0xogqcD6ol8BtA3vAjWdvMoQeupa9 mc1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TWGoRhIv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l123si10442311pfc.187.2019.02.11.07.57.23; Mon, 11 Feb 2019 07:57:39 -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=TWGoRhIv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730534AbfBKOeZ (ORCPT + 99 others); Mon, 11 Feb 2019 09:34:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730829AbfBKOeX (ORCPT ); Mon, 11 Feb 2019 09:34:23 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D13892081B; Mon, 11 Feb 2019 14:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895662; bh=pgrul5v2YJkS0YchezEKTN3v4csPbGObHqwfwbybJjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWGoRhIv02tE6bVswIbZ2J+023V5eAKyO7Mf58K4seouAknvnDK5siIlXvKIGwLxg c3EIlo1Ex4NDhPRFf9ViuQy8MEWEyNjVYwtR6u7nqmAV54TqBDmwDa14rg76KezTDW CBTBCDP4JWLhGFYYPfoA905MMiUSRYt9RAkvWB4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislav Fomichev , Jiri Olsa , Alexander Shishkin , Mathieu Poirier , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.20 250/352] perf build: Dont unconditionally link the libbfd feature test to -liberty and -lz Date: Mon, 11 Feb 2019 15:17:57 +0100 Message-Id: <20190211141903.016031324@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 d74bb9414d7c..81dda411e9d3 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -80,8 +80,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 304b984f11b9..912b82d4b70a 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -16,8 +16,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 \ @@ -204,7 +204,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 @@ -212,10 +212,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 acbb657f7ce2..a0f366c7a318 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -693,18 +693,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 @@ -714,24 +716,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