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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 15B3FC33CB2 for ; Tue, 28 Jan 2020 15:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC2FA207FD for ; Tue, 28 Jan 2020 15:29:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oudfIJtO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbgA1P34 (ORCPT ); Tue, 28 Jan 2020 10:29:56 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:52776 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgA1P3z (ORCPT ); Tue, 28 Jan 2020 10:29:55 -0500 Received: by mail-pj1-f68.google.com with SMTP id a6so1139461pjh.2 for ; Tue, 28 Jan 2020 07:29:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gYDQt040okirqe50Lrh3CEKmMOXPeZIYhDIO12JRm+M=; b=oudfIJtO2XN4XvD+DQ8Ec3GIHqxMMk6ogkt8jzO33dudjAqdner4DPznSzh1Y7XrBd ezD2ltpelFCHW3JRZgyfZqHAfW3s8KrKPaSSHQbDDQ7OXq3O+jtATKp0lwiThA4nB0uC BigxCmlYdVAHdBtxBc59/KBRJsff1bIIF2ifAGCQEx7s/wndc9NORpanY5iLzy/VqDpT Ja69ofWRIG1rsaAVpLA39lPLIkPyHjgG2/lirDlSXtlepON3OBYI/vPcMNV1OVcd5Maf 8hFcwuDd5SEU+oue9keSK6X4vxGhivjKuT3Hz03+l8HEs3uZw+qK8Vd992Nm4wuWg47y MbWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gYDQt040okirqe50Lrh3CEKmMOXPeZIYhDIO12JRm+M=; b=A+s6wicuBVjcyP6oBJZcS0KkG8ps96rhnWKHa1DiKP6idYSTKnhlUlbHwRDnS45vY3 EylYoM/iamGhD0lwUkgXn9y092J/xDRX81UC0xAivoh2XSrJ5QMoS26yAlLo+F6U7e97 uYE2j5To+D+SwSdy78AwCLhcUALkraL7+IKkuLepgQ9CRqslm2ucLbMlsfen4ur6HzGv hnGYhhI5Vr3RzUX/UYsfwMiT+klZsgtaKiXLiG/N+uKRPVbkfRYAA9jyv5EY9vtZHcMX erWdta535FrzMEzbh1DSLezGLCbppqrpyRa48xixZSCwty4lZyD/lQ5GiGc2Eb6OBpH5 yXJA== X-Gm-Message-State: APjAAAWM554O6B18uKkyZR8xnKm0z5Pkt4u46QfadBN1BW++FYYtNsS/ If4S1DoJJuqU2CuBGLwTQNk= X-Google-Smtp-Source: APXvYqwBUq02rMUM31o3VOkfKkq08ooJejdl8gGvivEbHXaXtorSAN7XrAd3mphmADoU5Yi8R+kxTw== X-Received: by 2002:a17:902:aa0b:: with SMTP id be11mr22410567plb.181.1580225394577; Tue, 28 Jan 2020 07:29:54 -0800 (PST) Received: from localhost.localdomain ([149.248.6.217]) by smtp.gmail.com with ESMTPSA id y6sm20632148pgc.10.2020.01.28.07.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2020 07:29:54 -0800 (PST) From: Changbin Du To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Jiri Olsa Cc: linux-kernel@vger.kernel.org, Changbin Du Subject: [PATCH] perf: Make perf able to build with latest libbfd Date: Tue, 28 Jan 2020 23:29:38 +0800 Message-Id: <20200128152938.31413-1-changbin.du@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Archived-At: List-Archive: List-Post: 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 --- 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 6ccf6f6d09df..5b7d6c16d33f 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -193,16 +193,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; -- 2.24.0