Skip to contentSkip to conversation

package/binutils: handle gprofng as an optional feature

PATCH Applied Thomas Petazzoni via buildroot 2 participants 4 messages Aug 13, 2022 – Aug 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/binutils: handle gprofng as an optional feature

binutils 2.39 added support for gprofng, a new profiler (see
https://www.phoronix.com/news/GNU-Profiler-gprofng).

This new profiler is enabled by default, but it requires bison on the host.

In order to handle this, this commit:

- Adds a new option BR2_BINUTILS_GPROFNG, which allows to enable/disable gprofng in host-binutils

- Unconditionnally disables gprofng for the target binutils, based on the idea that in a Buildroot context the analysis of profiling data is generally done on the host system. This can of course always be revisited later by adding a new option to the target binutils package.

---
 package/binutils/Config.in.host | 6 ++++++
 package/binutils/binutils.mk    | 8 ++++++++
 2 files changed, 14 insertions(+)
package/binutils/Config.in.host +6 -0
index 907b63de13..51802db043 100644
@@ -34,6 +34,12 @@ config BR2_BINUTILS_VERSION
 	default "2.38"		if BR2_BINUTILS_VERSION_2_38_X
 	default "2.39"		if BR2_BINUTILS_VERSION_2_39_X
 
+config BR2_BINUTILS_GPROFNG
+	bool "gprofng support"
+	depends on BR2_BINUTILS_VERSION_2_39_X
+	help
+	  This option enables support for gprofng, a new profiler.
+
 config BR2_BINUTILS_EXTRA_CONFIG_OPTIONS
 	string "Additional binutils options"
 	default ""
package/binutils/binutils.mk +8 -0
index a3fece27dc..e4cb19896d 100644
@@ -52,6 +52,7 @@ BINUTILS_CONF_OPTS = \
 	--enable-install-libiberty \
 	--enable-build-warnings=no \
 	--with-system-zlib \
+	--disable-gprofng \
 	$(BINUTILS_DISABLE_GDB_CONF_OPTS) \
 	$(BINUTILS_EXTRA_CONFIG_OPTIONS)
 
@@ -91,6 +92,13 @@ HOST_BINUTILS_CONF_OPTS = \
 	$(BINUTILS_DISABLE_GDB_CONF_OPTS) \
 	$(BINUTILS_EXTRA_CONFIG_OPTIONS)
 
+ifeq ($(BR2_BINUTILS_GPROFNG),y)
+HOST_BINUTILS_DEPENDENCIES += host-bison
+HOST_INBUTILS_CONF_OPTS += --enable-gprofng
+else
+HOST_INBUTILS_CONF_OPTS += --disable-gprofng
+endif
+
 # binutils run configure script of subdirs at make time, so ensure
 # our TARGET_CONFIGURE_ARGS are taken into consideration for those
 BINUTILS_MAKE_ENV = $(TARGET_CONFIGURE_ARGS)
Signature · 6 lines
2.37.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Thomas, All,

On 2022-08-13 12:51 +0200, Thomas Petazzoni via buildroot spake thusly:

Quoted 10 lines

binutils 2.39 added support for gprofng, a new profiler (see
https://www.phoronix.com/news/GNU-Profiler-gprofng).

This new profiler is enabled by default, but it requires bison on the host.

In order to handle this, this commit:

- Adds a new option BR2_BINUTILS_GPROFNG, which allows to enable/disable gprofng in host-binutils

I was wondering if we should not just unconditionally build it. The overhead of building host-bison and its dependencies is probably very low when compared to the rest of the toolchain, especially with TLPB.

But OK, option it is...

package/binutils/binutils.mk

Quoted 4 lines
package/binutils/binutils.mk +0 -0
index a3fece27dc..e4cb19896d 100644

[--SNIP--]

package/binutils/binutils.mk HOST_BINUTILS_CONF_OPTS = \ · line 99

Quoted 9 lines
package/binutils/binutils.mk +5 -0
@@ -91,6 +92,13 @@ HOST_BINUTILS_CONF_OPTS = \
 	$(BINUTILS_DISABLE_GDB_CONF_OPTS) \
 	$(BINUTILS_EXTRA_CONFIG_OPTIONS)
 
+ifeq ($(BR2_BINUTILS_GPROFNG),y)
+HOST_BINUTILS_DEPENDENCIES += host-bison
+HOST_INBUTILS_CONF_OPTS += --enable-gprofng
+else
+HOST_INBUTILS_CONF_OPTS += --disable-gprofng
    $ make check-package
    package/binutils/binutils.mk:97: possible typo: HOST_INBUTILS_CONF_OPTS -> *BINUTILS*
    package/binutils/binutils.mk:99: possible typo: HOST_INBUTILS_CONF_OPTS -> *BINUTILS*

Untested code? ;-)

Applied to next, with the above fixed, thanks.

Regards,
Yann E. MORIN.

Quoted 12 lines
package/binutils/binutils.mk +2 -0
+endif
+
 # binutils run configure script of subdirs at make time, so ensure
 # our TARGET_CONFIGURE_ARGS are taken into consideration for those
 BINUTILS_MAKE_ENV = $(TARGET_CONFIGURE_ARGS)
Signature · 6 lines
2.37.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello,

Quoted 8 lines · On Sat, 13 Aug 2022 23:43:16 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 2 lines

- Adds a new option BR2_BINUTILS_GPROFNG, which allows to enable/disable gprofng in host-binutils

I was wondering if we should not just unconditionally build it. The overhead of building host-bison and its dependencies is probably very low when compared to the rest of the toolchain, especially with TLPB.

But OK, option it is...

Yes, I agree this question is relevant.

Quoted 19 lines

package/binutils/binutils.mk

Quoted 4 lines
package/binutils/binutils.mk +0 -0
index a3fece27dc..e4cb19896d 100644

[--SNIP--]

package/binutils/binutils.mk HOST_BINUTILS_CONF_OPTS = \ · line 99

Quoted 9 lines
package/binutils/binutils.mk +5 -0
@@ -91,6 +92,13 @@ HOST_BINUTILS_CONF_OPTS = \
 	$(BINUTILS_DISABLE_GDB_CONF_OPTS) \
 	$(BINUTILS_EXTRA_CONFIG_OPTIONS)
 
+ifeq ($(BR2_BINUTILS_GPROFNG),y)
+HOST_BINUTILS_DEPENDENCIES += host-bison
+HOST_INBUTILS_CONF_OPTS += --enable-gprofng
+else
+HOST_INBUTILS_CONF_OPTS += --disable-gprofng  
    $ make check-package
    package/binutils/binutils.mk:97: possible typo: HOST_INBUTILS_CONF_OPTS -> *BINUTILS*
    package/binutils/binutils.mk:99: possible typo: HOST_INBUTILS_CONF_OPTS -> *BINUTILS*
Quoted 1 line

Untested code? ;-)

Meh, weird, I definitely tested it: I got a build failure before, and not after. Strange. Anyway, thanks for fixing and applying!

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
#3 lore raw

On 2022-08-13 23:46 +0200, Thomas Petazzoni spake thusly:

Quoted 7 lines
Quoted 3 lines · On Sat, 13 Aug 2022 23:43:16 +0200 "Yann E. MORIN" <[email protected]>…
    $ make check-package
    package/binutils/binutils.mk:97: possible typo: HOST_INBUTILS_CONF_OPTS -> *BINUTILS*
    package/binutils/binutils.mk:99: possible typo: HOST_INBUTILS_CONF_OPTS -> *BINUTILS*

Meh, weird, I definitely tested it: I got a build failure before, and not after. Strange. Anyway, thanks for fixing and applying!

Gah, I totally forgot to amend the commit before pushing. Grrr....

Fixed and pushed, now...

Damn, this heat-wave really had a toll on me... ;-]

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot