All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/uclibc: fix usage of DODEBUG option
@ 2022-08-03 20:06 Ben Wolsieffer
  2023-02-07 17:12 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Wolsieffer @ 2022-08-03 20:06 UTC (permalink / raw)
  To: buildroot; +Cc: Ben Wolsieffer, Thomas Petazzoni

The DODEBUG option passes -O0 and -DDEBUG to the compiler, which has a
significant impact on runtime behavior and performance. Currently,
DODEBUG is enabled by BR2_ENABLE_DEBUG, but it makes more sense for it
to be enabled by BR_ENABLE_RUNTIME_DEBUG.

This patch implements the above change, and also disables the DOSTRIP
option, allowing Builroot to decide whether binaries should be stripped.

Lastly, this patch adds $(TARGET_DEBUGGING) to the compiler flags, to
enable debug symbols when appropriate.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
Changes in v2:
  - Always disable DOSTRIP.
  - Only add $(TARGET_DEBUGGING) to CFLAGS, to avoid any unintended side
    effects.

 package/uclibc/uclibc.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index 0e17a8e65d..7e237c48e6 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -216,7 +216,7 @@ endif
 #
 # Debug
 #
-ifeq ($(BR2_ENABLE_DEBUG),y)
+ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
 define UCLIBC_DEBUG_CONFIG
 	$(call KCONFIG_ENABLE_OPT,DODEBUG)
 endef
@@ -374,7 +374,7 @@ endif
 # Commands
 #
 
-UCLIBC_EXTRA_CFLAGS = $(TARGET_ABI)
+UCLIBC_EXTRA_CFLAGS = $(TARGET_ABI) $(TARGET_DEBUGGING)
 
 # uClibc-ng does not build with LTO, so explicitly disable it
 # when using a compiler that may have support for LTO
@@ -396,6 +396,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS
 	$(call KCONFIG_SET_OPT,RUNTIME_PREFIX,"/")
 	$(call KCONFIG_SET_OPT,DEVEL_PREFIX,"/usr")
 	$(call KCONFIG_SET_OPT,SHARED_LIB_LOADER_PREFIX,"/lib")
+	$(call KCONFIG_DISABLE_OPT,DOSTRIP)
 	$(UCLIBC_MMU_CONFIG)
 	$(UCLIBC_BINFMT_CONFIG)
 	$(UCLIBC_AARCH64_PAGE_SIZE_CONFIG)
-- 
2.37.0

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

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

* Re: [Buildroot] [PATCH v2] package/uclibc: fix usage of DODEBUG option
  2022-08-03 20:06 [Buildroot] [PATCH v2] package/uclibc: fix usage of DODEBUG option Ben Wolsieffer
@ 2023-02-07 17:12 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-02-07 17:12 UTC (permalink / raw)
  To: Ben Wolsieffer; +Cc: buildroot

Hello Ben,

On Wed,  3 Aug 2022 16:06:29 -0400
Ben Wolsieffer <ben.wolsieffer@hefring.com> wrote:

> The DODEBUG option passes -O0 and -DDEBUG to the compiler, which has a
> significant impact on runtime behavior and performance. Currently,
> DODEBUG is enabled by BR2_ENABLE_DEBUG, but it makes more sense for it
> to be enabled by BR_ENABLE_RUNTIME_DEBUG.
> 
> This patch implements the above change, and also disables the DOSTRIP
> option, allowing Builroot to decide whether binaries should be stripped.
> 
> Lastly, this patch adds $(TARGET_DEBUGGING) to the compiler flags, to
> enable debug symbols when appropriate.
> 
> Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
> ---
> Changes in v2:
>   - Always disable DOSTRIP.
>   - Only add $(TARGET_DEBUGGING) to CFLAGS, to avoid any unintended side
>     effects.

So after quite some time, I finally took care of your patch (sorry for
the delay!). I ended up splitting it into 3 separate commits, because
even though they are related, the 3 aspects are distinct. So here you
are:

commit f9867a725c12975af52dda9dffbdc33c3b0312db
Author: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
Date:   Tue Feb 7 17:53:37 2023 +0100

    package/uclibc: enable DODEBUG when BR2_ENABLE_RUNTIME_DEBUG
    
    The DODEBUG=y option of uClibc causes uClibc to be built with -O0 and
    -DDEBUG, which has a significant runtime performance
    impact. Currently, DODEBUG=y is passed when BR2_ENABLE_DEBUG=y, but
    BR2_ENABLE_DEBUG is only about enabling debugging symbols, not about
    runtime debugging additions. The more recently added
    BR2_ENABLE_RUNTIME_DEBUG option is precisely designed for that, so we
    changed the logic to pass DODEBUG=y when BR2_ENABLE_RUNTIME_DEBUG=y,
    and not BR2_ENABLE_DEBUG=y.
    
    This allows to build uClibc with debugging symbols when
    BR2_ENABLE_DEBUG=y, without disabling optimizations and adding more
    debugging features that have a runtime performance impact.
    
    Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
    [Thomas: extracted from
    https://patchwork.ozlabs.org/project/buildroot/patch/20220803200629.3172370-1-Ben.Wolsieffer@hefring.com/
    and split into its own independent patch.]
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

commit 17481bd0bf6abff260ccc579974b813050f91d4e
Author: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
Date:   Tue Feb 7 17:52:21 2023 +0100

    package/uclibc: pass $(TARGET_DEBUGGING) flags
    
    In order to have debugging symbols in uClibc, let's pass
    $(TARGET_DEBUGGING) in UCLIBC_EXTRA_CFLAGS.
    
    Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
    [Thomas: extracted from
    https://patchwork.ozlabs.org/project/buildroot/patch/20220803200629.3172370-1-Ben.Wolsieffer@hefring.com/
    and split into its own independent patch.]
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

commit cf92dcfaa92f6564830d10d4e18ae00fd8102ab2
Author: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
Date:   Tue Feb 7 17:50:59 2023 +0100

    package/uclibc: don't let uClibc build system strip uClibc
    
    Let Buildroot handle this, so we can have an unstripped uClibc if
    needed.
    
    Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
    [Thomas: extracted from
    https://patchwork.ozlabs.org/project/buildroot/patch/20220803200629.3172370-1-Ben.Wolsieffer@hefring.com/
    and split into its own independent patch.]
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-02-07 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 20:06 [Buildroot] [PATCH v2] package/uclibc: fix usage of DODEBUG option Ben Wolsieffer
2023-02-07 17:12 ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.