Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Matyukevich <geomatsi@gmail.com>
To: buildroot@buildroot.org
Cc: Romain Naour <romain.naour@gmail.com>,
	Giulio Benetti <giulio.benetti@benettiengineering.com>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	Sergey Matyukevich <geomatsi@gmail.com>
Subject: [Buildroot] [PATCH v2 1/2] package/linux-tools: perf: add explicit option for libbfd support
Date: Tue, 27 Aug 2024 00:44:23 +0300	[thread overview]
Message-ID: <20240826214434.1530363-2-geomatsi@gmail.com> (raw)
In-Reply-To: <20240826214434.1530363-1-geomatsi@gmail.com>

Before Linux v6.4, libbfd support in perf was opted in by default and
could be disabled using NO_LIBBFD=1. Starting from Linux v6.4, libbfd
support in perf is opted out by default and can be enabled with new
variable BUILD_NONDISTRO=1. For details see the kernel commit [1].

Linking perf against libbfd library may significantly speed up perf
report and script commands for data recorded with call-graph information
based on DWARF format. Without libbfd perf executes a new addr2line
process for every address it needs to look up. However perf linked
against libbfd may become undistributable since perf is licenced
under GPLv2 and binutils libraries are licenced under GPLv3+.
For more detais see Debian bug report [2].

This commit adds a new BR2_PACKAGE_LINUX_TOOLS_PERF_LIBBFD option to
perf to explicitly enable libbfd support when appropriate. Note that
enabling binutils in the configuration does not implicitly enable libbfd
support for perf anymore. Also note that if the new option is not
enabled in the configuration, then the legacy NO_DEMANGLE and NO_LIBBFD
options will be set for perf in order to explicitly disable libbfd
support in pre-v6.4 Linux kernels.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dd317df072071903031ab5f91b4823858445c4a0
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911815

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
---
 package/linux-tools/Config.in             | 10 ++++++++++
 package/linux-tools/linux-tool-perf.mk.in | 15 +++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
index 5a38f6dafe..de89238bca 100644
--- a/package/linux-tools/Config.in
+++ b/package/linux-tools/Config.in
@@ -112,6 +112,16 @@ config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI
 	  enables zooming into DSOs and threads as well as other
 	  features.
 
+config BR2_PACKAGE_LINUX_TOOLS_PERF_LIBBFD
+	bool "link perf against libbfd"
+	select BR2_PACKAGE_BINUTILS
+	help
+	  Link perf against libbfd library from binutils. This option may
+	  significantly speed up perf report and script commands for data
+	  recorded with call-graph information based on DWARF debug format.
+	  However the result is undistributable since perf is licenced
+	  under GPLv2 and binutils libraries are licenced under GPLv3+.
+
 config BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3
 	bool "perf need python3 to build"
 	select BR2_PACKAGE_HOST_PYTHON3
diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
index 65aba2e9fe..ea98e56450 100644
--- a/package/linux-tools/linux-tool-perf.mk.in
+++ b/package/linux-tools/linux-tool-perf.mk.in
@@ -67,6 +67,15 @@ else
 PERF_MAKE_FLAGS += NO_NEWT=1 NO_SLANG=1
 endif
 
+ifeq ($(BR2_PACKAGE_LINUX_TOOLS_PERF_LIBBFD),y)
+PERF_DEPENDENCIES += binutils
+# Explicitely enable for Linux >= v6.4
+PERF_MAKE_FLAGS += BUILD_NONDISTRO=1
+else
+# Explicitely disable for Linux < v6.4
+PERF_MAKE_FLAGS += NO_DEMANGLE=1 NO_LIBBFD=1
+endif
+
 ifeq ($(BR2_PACKAGE_AUDIT),y)
 PERF_DEPENDENCIES += audit
 else
@@ -95,12 +104,6 @@ else
 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
 endif
 
-ifeq ($(BR2_PACKAGE_BINUTILS),y)
-PERF_DEPENDENCIES += binutils
-else
-PERF_MAKE_FLAGS += NO_DEMANGLE=1
-endif
-
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 PERF_DEPENDENCIES += openssl
 else
-- 
2.46.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-08-26 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 21:44 [Buildroot] [PATCH v2 0/2] perf: add binutils support in new kernels Sergey Matyukevich
2024-08-26 21:44 ` Sergey Matyukevich [this message]
2025-01-21 18:40   ` [Buildroot] [PATCH v2 1/2] package/linux-tools: perf: add explicit option for libbfd support Sergey Matyukevich
2024-08-26 21:44 ` [Buildroot] [PATCH v2 2/2] package: binutils: install libsframe to target Sergey Matyukevich
2026-10-11 13:46   ` Thomas Petazzoni via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240826214434.1530363-2-geomatsi@gmail.com \
    --to=geomatsi@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=romain.naour@gmail.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox