From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C390FC433DF for ; Thu, 2 Jul 2020 12:42:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98FFF2088E for ; Thu, 2 Jul 2020 12:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593693734; bh=oEPMOrl5gOT0FsyHfygw3so6SkLEhFqkRhcwfdwKeS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OqYz+3tlMlsxh9+lPaWDW7Zkgeoi+wv3O3MUNq57MFuh/lhxz0S68Qy0qJtwrgtmD R+D8QdO1wJNB06He+/RYhGzuF4X1BtoHnoXj6s7M2ZKMr2eCKcI/m/f/HfHxB0pC3c Hp7Qq6TA2ZkRl8grKIAAgrcKSEcB8/FLOXWXxTC4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728976AbgGBMmO (ORCPT ); Thu, 2 Jul 2020 08:42:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:48144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728893AbgGBMmN (ORCPT ); Thu, 2 Jul 2020 08:42:13 -0400 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 D4BE320885; Thu, 2 Jul 2020 12:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593693733; bh=oEPMOrl5gOT0FsyHfygw3so6SkLEhFqkRhcwfdwKeS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8budiXrfE64fmTlkd0n1pK72DE25MhbTVhU8IcjuF0MeEsdjAQMs+Vx0Omn8bRI/ mdc5O19wizGihmQF4mj+TmF1O56jMRdT+wqmTFBdateoqtVU5uP/NKhb5dA/3BnpP7 HKNeNw/ib/FbQukguUV/yUCeLxYHhjgWB+yIUEjY= From: Masami Hiramatsu To: stable@vger.kernel.org Cc: Sergey Senozhatsky , Changbin Du , Jiri Olsa , Arnaldo Carvalho de Melo , mhiramat@kernel.org Subject: [PATCH for 4.4.y 4/5] perf: Make perf able to build with latest libbfd Date: Thu, 2 Jul 2020 21:42:09 +0900 Message-Id: <159369372956.82195.13259704917220595682.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <159369369207.82195.5763005209795799082.stgit@devnote2> References: <159369369207.82195.5763005209795799082.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Changbin Du commit 0ada120c883d4f1f6aafd01cf0fbb10d8bbba015 upstream. libbfd has changed the bfd_section_* macros to inline functions bfd_section_ since 2019-09-18. See below two commits: o http://www.sourceware.org/ml/gdb-cvs/2019-09/msg00064.html o https://www.sourceware.org/ml/gdb-cvs/2019-09/msg00072.html This fix make perf able to build with both old and new libbfd. Signed-off-by: Changbin Du Acked-by: Jiri Olsa Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20200128152938.31413-1-changbin.du@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/srcline.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index b4db3f48e3b0..2853d4728ab9 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -86,16 +86,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data) bfd_vma pc, vma; bfd_size_type size; struct a2l_data *a2l = data; + flagword flags; if (a2l->found) return; - if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) +#ifdef bfd_get_section_flags + flags = bfd_get_section_flags(abfd, section); +#else + flags = bfd_section_flags(section); +#endif + if ((flags & SEC_ALLOC) == 0) return; pc = a2l->addr; +#ifdef bfd_get_section_vma vma = bfd_get_section_vma(abfd, section); +#else + vma = bfd_section_vma(section); +#endif +#ifdef bfd_get_section_size size = bfd_get_section_size(section); +#else + size = bfd_section_size(section); +#endif if (pc < vma || pc >= vma + size) return;