Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp537546ybl; Tue, 28 Jan 2020 07:31:16 -0800 (PST) X-Google-Smtp-Source: APXvYqwfDA98aOzJBuwl01fsBsqw7QLFid/enQI7TKh7vGJofFKvbayu+UuUUtiC2Sqi5ld6NzKb X-Received: by 2002:a9d:53c4:: with SMTP id i4mr17835968oth.48.1580225476329; Tue, 28 Jan 2020 07:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580225476; cv=none; d=google.com; s=arc-20160816; b=VFSxHtC+ptzSxvY7QyWyaZ627hsGcCUhxnvXsQiH3qUt7O3ftzg9fTpw/mopzN6wM8 9i8aKoGkll/i0MlZ4aNGV9EvA4BLarnka3sVyL641cvz7cAWj0bju3mW8tey9QzMn89M g7NI0cq5cppf0Kz1V0hzxSMiosH5F6DenVrGZv96Agf09/cs8WiY7gqFWBoj6RcUUeiu rBRq4IoRKFM6h+o5NFsTkfYg+GdZGDMsPzwTZTeQRkbLPnRL+PLXCnln7/BgjB/kz/UB ICEmxm9NEbCw+rjc3VHnp5OGkYvz+jknSkc+5im/bzCb7kB8YXsO9dYRUhNyjqVdV44Z 7JLg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=gYDQt040okirqe50Lrh3CEKmMOXPeZIYhDIO12JRm+M=; b=kyEmmU5IKs2Z0txblb4p1JIqB+UZz577qoOZyH2eFn8CJ3j6h0mPlUDQHXIvuy6Mrq wGon0gKNZH53VbQGRhNPjORBW5U7NE3S+p0mEXFoE2Lhf1CuQGOGyv6AdT/OE+A0aQw7 GVZeyWr8VKBGWKEh8ggbzddUvo7FV0FtCulj+JtHKMYXC9vBFbKURxYmTJyQBN9rnLRl X71lGKCFV+nYKQZu9kuRJhQTnvTQQ9NwhZDRYrt6BaZxkZ/3CJf0tB9po3ClLHdO4FFm XMlWNKGh9ytRyOSkRUMmj/AFOOgR1Y2vAILcA5iQuToP+VPRUKfEnTOcWS+Wz6SNDwlq Xnjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oudfIJtO; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w24si4730693oic.260.2020.01.28.07.31.03; Tue, 28 Jan 2020 07:31:16 -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=@gmail.com header.s=20161025 header.b=oudfIJtO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbgA1P3z (ORCPT + 99 others); Tue, 28 Jan 2020 10:29:55 -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-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 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