Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] perf: add binutils support in new kernels
@ 2024-08-25 19:41 Sergey Matyukevich
  2024-08-25 19:41 ` [Buildroot] [PATCH 1/2] package: binutils: install libsframe to target Sergey Matyukevich
  2024-08-25 19:41 ` [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support Sergey Matyukevich
  0 siblings, 2 replies; 4+ messages in thread
From: Sergey Matyukevich @ 2024-08-25 19:41 UTC (permalink / raw)
  To: buildroot
  Cc: Romain Naour, Giulio Benetti, Yann E . MORIN, Sergey Matyukevich

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(+)

-- 
2.46.0

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 1/2] package: binutils: install libsframe to target
  2024-08-25 19:41 [Buildroot] [PATCH 0/2] perf: add binutils support in new kernels Sergey Matyukevich
@ 2024-08-25 19:41 ` Sergey Matyukevich
  2024-08-25 19:41 ` [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support Sergey Matyukevich
  1 sibling, 0 replies; 4+ messages in thread
From: Sergey Matyukevich @ 2024-08-25 19:41 UTC (permalink / raw)
  To: buildroot
  Cc: Romain Naour, Giulio Benetti, Yann E . MORIN, 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_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.

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
---
 package/binutils/binutils.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk
index d98dd7b830..b459d4a271 100644
--- a/package/binutils/binutils.mk
+++ b/package/binutils/binutils.mk
@@ -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
 
-- 
2.46.0

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support
  2024-08-25 19:41 [Buildroot] [PATCH 0/2] perf: add binutils support in new kernels Sergey Matyukevich
  2024-08-25 19:41 ` [Buildroot] [PATCH 1/2] package: binutils: install libsframe to target Sergey Matyukevich
@ 2024-08-25 19:41 ` Sergey Matyukevich
  2024-08-26 13:05   ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 4+ messages in thread
From: Sergey Matyukevich @ 2024-08-25 19:41 UTC (permalink / raw)
  To: buildroot
  Cc: Romain Naour, Giulio Benetti, Yann E . MORIN, Sergey Matyukevich

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].
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.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dd317df072071903031ab5f91b4823858445c4a0

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

diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
index 5a38f6dafe..e87a1d571a 100644
--- a/package/linux-tools/Config.in
+++ b/package/linux-tools/Config.in
@@ -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
diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
index 65aba2e9fe..c26a3eb31b 100644
--- a/package/linux-tools/linux-tool-perf.mk.in
+++ b/package/linux-tools/linux-tool-perf.mk.in
@@ -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
-- 
2.46.0

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support
  2024-08-25 19:41 ` [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support Sergey Matyukevich
@ 2024-08-26 13:05   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-08-26 13:05 UTC (permalink / raw)
  To: Sergey Matyukevich
  Cc: Romain Naour, Giulio Benetti, Yann E . MORIN, buildroot

Hello Sergey,

On Sun, 25 Aug 2024 22:41:09 +0300
Sergey Matyukevich <geomatsi@gmail.com> wrote:

> 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/

> 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/

> 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/

> NO_LIBBFD will be set for perf in pre-v6.4 Linux kernels.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dd317df072071903031ab5f91b4823858445c4a0
> 
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> ---
>  package/linux-tools/Config.in             | 6 ++++++
>  package/linux-tools/linux-tool-perf.mk.in | 7 +++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
> index 5a38f6dafe..e87a1d571a 100644
> --- a/package/linux-tools/Config.in
> +++ b/package/linux-tools/Config.in
> @@ -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?

> +	help
> +	  Enable building an linking against libbfd and libiberty

s/an/and/

> +	  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
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-26 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-25 19:41 [Buildroot] [PATCH 0/2] perf: add binutils support in new kernels Sergey Matyukevich
2024-08-25 19:41 ` [Buildroot] [PATCH 1/2] package: binutils: install libsframe to target Sergey Matyukevich
2024-08-25 19:41 ` [Buildroot] [PATCH 2/2] package/linux-tools: perf: explicit option for libbfd support Sergey Matyukevich
2024-08-26 13:05   ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox