perf: add binutils support in new kernels
cover perf: add binutils support in new kernels
Hi all,
This patch series fixes libbfd (binutils) support in perf for the binutils >= 2.40 and the Linux kernels >= v6.4. New kernels have a new 'opted out' perf build option for libbfd support. At the same time, new binutils provides new libsframe library, which should be installed to the target together with libbfd and libopcodes.
Sergey Matyukevich (2):
package: binutils: install libsframe to target package/linux-tools: perf: explicit option for libbfd support
package/binutils/binutils.mk | 1 + package/linux-tools/Config.in | 6 ++++++ package/linux-tools/linux-tool-perf.mk.in | 7 +++++++ 3 files changed, 14 insertions(+)
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 package: binutils: install libsframe to target
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_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 always install libsframe the target.
--- 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
PATCH 2/2 package/linux-tools: perf: explicit option for libbfd support
In reply to Sergey MatyukevichBefore 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]. In brief, the reason why libbfd support in perf is usually disabled is license: binutils is GPLv3, so some distributions can not ship perf linked against libbfd.
This commit adds new NONDISTRO option for perf to explicitly enable libbfd support in perf when appropriate. Note that if binutils is enabled in config, but NONDISTRO is not enabled, then legacy option NO_LIBBFD will be set for perf in pre-v6.4 Linux kernels.
--- package/linux-tools/Config.in | 6 ++++++ package/linux-tools/linux-tool-perf.mk.in | 7 +++++++ 2 files changed, 13 insertions(+)
package/linux-tools/Config.in +6 -0
@@ -112,6 +112,12 @@ config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI enables zooming into DSOs and threads as well as other features. +config BR2_PACKAGE_LINUX_TOOLS_PERF_NONDISTRO + bool "enable perf NONDISTRO" + help + Enable building an linking against libbfd and libiberty + distribution license incompatible libraries. + 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 +7 -0
@@ -96,7 +96,14 @@ PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1 endif ifeq ($(BR2_PACKAGE_BINUTILS),y) +ifeq ($(BR2_PACKAGE_LINUX_TOOLS_PERF_NONDISTRO),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 else PERF_MAKE_FLAGS += NO_DEMANGLE=1 endif
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support
Hello Sergey,
Quoted 3 lines · On Sun, 25 Aug 2024 22:41:09 +0300 Sergey Matyukevich <[email protected]>…
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
s/with new/with the new/
Quoted 6 lines
variable BUILD_NONDISTRO=1. For details see the kernel commit [1]. In brief, the reason why libbfd support in perf is usually disabled is license: binutils is GPLv3, so some distributions can not ship perf linked against libbfd.
This commit adds new NONDISTRO option for perf to explicitly enable
s/adds new/adds a new/
s/for perf/to perf/
Quoted 2 lines
libbfd support in perf when appropriate. Note that if binutils is enabled in config, but NONDISTRO is not enabled, then legacy option
s/in config/in the configuration/
s/then legacy/then the legacy option/
Quoted 15 lines
NO_LIBBFDwill be set for perf in pre-v6.4 Linux kernels.Signed-off-by Sergey Matyukevich <[email protected]>--- package/linux-tools/Config.in | 6 ++++++ package/linux-tools/linux-tool-perf.mk.in | 7 +++++++ 2 files changed, 13 insertions(+)package/linux-tools/Config.in +0
-0
package/linux-tools/Config.in config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI · line 116
Quoted 5 lines
package/linux-tools/Config.in +2
-0@@ -112,6 +112,12 @@ config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI enables zooming into DSOs and threads as well as other features. +config BR2_PACKAGE_LINUX_TOOLS_PERF_NONDISTRO + bool "enable perf NONDISTRO"
I know the upstream variable is named NONDISTRO, but to mean "NONDISTRO" doesn't make any sense. Shouldn't this be named after the feature it provides, or after binutils, or something?
package/linux-tools/Config.in config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI · line 118
Quoted 2 lines
package/linux-tools/Config.in +2
-0+ help + Enable building an linking against libbfd and libiberty
s/an/and/
package/linux-tools/Config.in config BR2_PACKAGE_LINUX_TOOLS_PERF_TUI · line 119
Quoted 1 line
package/linux-tools/Config.in +1
-0+ distribution license incompatible libraries.
incompatible with what? Is it the fact that tools/perf is GPLv2 only and libbfd/libiberty are GPLv3+ ?
I think this help text needs to be improved to really explained what happens.
Thanks!
Thomas
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