perf: add binutils support in new kernels
v2 cover perf: add binutils support in new kernels
Hi all,
This patch series updates libbfd (binutils) support in perf for the binutils >= 2.40 and the Linux kernels >= v6.4. New versions bring the following changes:
- new kernels have a new 'opted out' perf build option for libbfd support
- new binutils provide new libsframe library
New libsframe library needs to be installed to the target images since libbfd and libopcodes are linked against it. Perf recipe needs to be updated to use new perf option for libbfd support in the new kernels.
Regards,
Sergey
v1 -> v2
- update help message for a new perf configuration option
- select binutils if libbfd perf support is enabled
- update commit message
Sergey Matyukevich (2):
package/linux-tools: perf: add explicit option for libbfd support
package: binutils: install libsframe to target
package/binutils/binutils.mk | 1 + package/linux-tools/Config.in | 10 ++++++++++ package/linux-tools/linux-tool-perf.mk.in | 15 +++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-)
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/2 package/linux-tools: perf: add explicit option for libbfd support
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
--- package/linux-tools/Config.in | 10 ++++++++++ package/linux-tools/linux-tool-perf.mk.in | 15 +++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-)
package/linux-tools/Config.in +10 -0
@@ -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
package/linux-tools/linux-tool-perf.mk.in +9 -6
@@ -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
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 1/2] package/linux-tools: perf: add explicit option for libbfd support
Hi all,
Quoted 21 lines
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_LIBBFDoption 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 legacyNO_DEMANGLEandNO_LIBBFDoptions will be set for perf in order to explicitly disable libbfd support in pre-v6.4 Linux kernels.
Quoted 8 lines
[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=911815Signed-off-by Sergey Matyukevich <[email protected]>--- package/linux-tools/Config.in | 10 ++++++++++ package/linux-tools/linux-tool-perf.mk.in | 15 +++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-)
Friendly ping. Any thoughs or comments regarding this one ?
Regards,
Sergey
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 2/2 package: binutils: install libsframe to target
In reply to Sergey MatyukevichStarting from v2.40, binutils provides libsframe, a library for manipulating the SFRAME debug format. Buildroot installs libsframe to the target image only if BR2_PACKAGE_BINUTILS_TARGET option is enabled. However other dynamic libraries from binutils are linked against libsframe, including libbfd and libopcodes. Any binary linked dynamically against libbfd, e.g. perf, will need libsframe as well. So libsframe should always be installed the target together with other binutils libraries such as libbfd and libopcodes.
--- package/binutils/binutils.mk | 1 + 1 file changed, 1 insertion(+)
package/binutils/binutils.mk +1 -0
@@ -120,6 +120,7 @@ ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y) define BINUTILS_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/opcodes DESTDIR=$(TARGET_DIR) install + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/libsframe DESTDIR=$(TARGET_DIR) install endef endif
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedRe: [Buildroot] [PATCH v2 2/2] package: binutils: install libsframe to target
Quoted 10 lines · Sergey Matyukevich
Starting from v2.40, binutils provides libsframe, a library for manipulating the SFRAME debug format. Buildroot installs libsframe to the target image only if
BR2_PACKAGE_BINUTILS_TARGEToption is enabled. However other dynamic libraries from binutils are linked against libsframe, including libbfd and libopcodes. Any binary linked dynamically against libbfd, e.g. perf, will need libsframe as well. So libsframe should always be installed the target together with other binutils libraries such as libbfd and libopcodes.Signed-off-by Sergey Matyukevich <[email protected]>
Applied to master, thanks!
Best regards,
Thomas Petazzoni
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedRe: [Buildroot] [PATCH v2 2/2] package: binutils: install libsframe to target
In reply to Sergey MatyukevichIn reply of:
Quoted 10 lines
Starting from v2.40, binutils provides libsframe, a library for manipulating the SFRAME debug format. Buildroot installs libsframe to the target image only if
BR2_PACKAGE_BINUTILS_TARGEToption is enabled. However other dynamic libraries from binutils are linked against libsframe, including libbfd and libopcodes. Any binary linked dynamically against libbfd, e.g. perf, will need libsframe as well. So libsframe should always be installed the target together with other binutils libraries such as libbfd and libopcodes.Signed-off-by Sergey Matyukevich <[email protected]>
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 9 lines
--- package/binutils/binutils.mk | 1 + 1 file changed, 1 insertion(+)package/binutils/binutils.mk +0
-0
package/binutils/binutils.mk ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y) · line 126
Quoted 7 lines
package/binutils/binutils.mk +1
-0@@ -120,6 +120,7 @@ ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y) define BINUTILS_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/opcodes DESTDIR=$(TARGET_DIR) install + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/libsframe DESTDIR=$(TARGET_DIR) install endef endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot