public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v7 1/6] distro/include: rework debug friendly optimization
@ 2025-12-22 14:53 Hongxu Jia
  2025-12-22 14:53 ` [PATCH v7 2/6] debug-optimize.inc: collect debug optimization tuning configuration Hongxu Jia
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Hongxu Jia @ 2025-12-22 14:53 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt, richard.purdie

The problem with DEBUG_BUILD is that we have a lot of debug information
in builds anyway and this is now unclear what it means. The
documentation.conf entry mentions packages which is now incorrect too.
The variable is a very old one and the interface is poorly designed
compared to other areas now.

This commit drop DEBUG_BUILD, use DEBUG_OPTIMIZE to instead, add
debug-optimize.bbclass and debug-optimize.inc. Use variable DEBUG_OPTIMIZE
to defer inherit debug-optimize.bbclass conditionally.

Make a config fragment core/yocto/debug-optimize to set DEBUG_OPTIMIZE ?= 1
to enable debug friendly optimize. For the recipe (such as qemu) which doesn't
work with debug optimization, set DEBUG_OPTIMIZE = "0" to disable it for a
given recipe even though config fragment core/yocto/debug-optimize is enabled

In bitbake.conf, use ??= to set *_OPTIMIZATION, in debug-optimize.inc
to use ?= to override *_OPTIMIZATION

In debug-optimize.bbclass, include_all debug-optimize.inc to allow other
layers to add their own debug optimization configurations.

User should use the following ways to enable debug optimize

  $ bitbake-config-build enable-fragment core/yocto/debug-optimize

Or

  $ echo 'OE_FRAGMENTS += "core/yocto/debug-optimize"' >> conf/local.conf

NOTE: we do not encourage user to enable debug friendly optimization by setting
DEBUG_OPTIMIZE = '1' directly, because the variable override is not certainty,
which is affected by the order of configuration parsing

Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-global/base.bbclass                       | 3 +++
 meta/classes/debug-optimize.bbclass                    | 8 ++++++++
 meta/conf/bitbake.conf                                 | 9 +++------
 meta/conf/distro/include/debug-optimize.inc            | 5 +++++
 meta/conf/documentation.conf                           | 4 ++--
 meta/conf/fragments/yocto/debug-optimize.conf          | 7 +++++++
 meta/conf/templates/default/local.conf.sample.extended | 2 +-
 meta/recipes-devtools/qemu/qemu.inc                    | 4 ++--
 8 files changed, 31 insertions(+), 11 deletions(-)
 create mode 100644 meta/classes/debug-optimize.bbclass
 create mode 100644 meta/conf/distro/include/debug-optimize.inc
 create mode 100644 meta/conf/fragments/yocto/debug-optimize.conf

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index cf303c237a..3c9488cd45 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -35,6 +35,9 @@ TOOLCHAIN_NATIVE ??= "${PREFERRED_TOOLCHAIN_NATIVE}"
 inherit_defer toolchain/${TOOLCHAIN_NATIVE}-native
 inherit_defer toolchain/${TOOLCHAIN}
 
+DEBUG_OPTIMIZE ??= "0"
+inherit_defer ${@oe.utils.vartrue('DEBUG_OPTIMIZE', 'debug-optimize', '',d)}
+
 def lsb_distro_identifier(d):
     adjust = d.getVar('LSB_DISTRO_ADJUST')
     adjust_func = None
diff --git a/meta/classes/debug-optimize.bbclass b/meta/classes/debug-optimize.bbclass
new file mode 100644
index 0000000000..8d26d03c2c
--- /dev/null
+++ b/meta/classes/debug-optimize.bbclass
@@ -0,0 +1,8 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# Allow other layers to add their own debug build configurations
+include_all conf/distro/include/debug-optimize.inc
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 88f4d0df69..653d396c79 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -659,13 +659,10 @@ DEBUG_PREFIX_MAP ?= "${DEBUG_PREFIX_MAP_EXTRA} \
 "
 DEBUG_LEVELFLAG ?= "-g"
 
-FULL_OPTIMIZATION = "-O2 ${DEBUG_LEVELFLAG}"
-DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}"
-SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
-SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
+FULL_OPTIMIZATION ??= "-O2 ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION ??= "${FULL_OPTIMIZATION}"
 # compiler flags for native/nativesdk
-BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}"
-BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
+BUILD_OPTIMIZATION ??= "-O2"
 
 ##################################################################
 # Reproducibility
diff --git a/meta/conf/distro/include/debug-optimize.inc b/meta/conf/distro/include/debug-optimize.inc
new file mode 100644
index 0000000000..b5fb3bbf78
--- /dev/null
+++ b/meta/conf/distro/include/debug-optimize.inc
@@ -0,0 +1,5 @@
+# Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when fragment 'core/yocto/debug-optimize' is enabled.
+DEBUG_OPTIMIZATION ?= "-Og ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION ?= "${DEBUG_OPTIMIZATION}"
+# compiler flags for native/nativesdk
+BUILD_OPTIMIZATION ?= "-Og -g"
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 741130a392..956d4a79a6 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -129,8 +129,8 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] = "Defines which layers to include during cve-c
 D[doc] = "The destination directory."
 DATE[doc] = "The date the build was started using YMD format."
 DATETIME[doc] = "The date and time the build was started."
-DEBUG_BUILD[doc] = "Specifies to build packages with debugging information. This influences the value of the SELECTED_OPTIMIZATION variable."
 DEBUG_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling a system for debugging. This variable defaults to '-Og ${DEBUG_LEVELFLAG}'."
+DEBUG_OPTIMIZE[doc] = "Specifies to build recipe with debugging friendly optimization. This influences the value of the SELECTED_OPTIMIZATION variable."
 DEFAULT_PREFERENCE[doc] = "Specifies a weak bias for recipe selection priority."
 DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)."
 DEPLOY_DIR[doc] = "Points to the general area that the OpenEmbedded build system uses to place images, packages, SDKs and other output files that are ready to be used outside of the build system."
@@ -370,7 +370,7 @@ SDK_OUTPUT[doc] = "The location used by the OpenEmbedded build system when creat
 SDKIMAGE_FEATURES[doc] = "Equivalent to IMAGE_FEATURES. However, this variable applies to the SDK generated from an image using the command 'bitbake -c populate_sdk imagename'."
 SDKMACHINE[doc] = "Specifies the architecture (i.e. i686 or x86_64) for which to build SDK and ADT items."
 SECTION[doc] = "The section in which packages should be categorized. Package management utilities can make use of this variable."
-SELECTED_OPTIMIZATION[doc] = "The variable takes the value of FULL_OPTIMIZATION unless DEBUG_BUILD = '1'. In this case, the value of DEBUG_OPTIMIZATION is used."
+SELECTED_OPTIMIZATION[doc] = "The variable takes the value of FULL_OPTIMIZATION unless fragment 'core/yocto/debug-optimize' is enabled. In this case, the value of DEBUG_OPTIMIZATION is used."
 SERIAL_CONSOLES[doc] = "Defines the serial consoles (TTYs) to enable using getty."
 SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS[doc] = "A list of recipe dependencies that should not be used to determine signatures of tasks from one recipe when they depend on tasks from another recipe."
 SIGGEN_EXCLUDERECIPES_ABISAFE[doc] = "A list of recipes that are completely stable and will never change."
diff --git a/meta/conf/fragments/yocto/debug-optimize.conf b/meta/conf/fragments/yocto/debug-optimize.conf
new file mode 100644
index 0000000000..000b5a50cd
--- /dev/null
+++ b/meta/conf/fragments/yocto/debug-optimize.conf
@@ -0,0 +1,7 @@
+BB_CONF_FRAGMENT_SUMMARY = "Specifies to build recipes with debugging friendly optimization. \
+This influences the value of the SELECTED_OPTIMIZATION variable."
+BB_CONF_FRAGMENT_DESCRIPTION = "Enables full debug and backtrace capabilities for all programs \
+and libraries in the image, by modifying the SELECTED_OPTIMIZATION variable, \
+setting it to "DEBUG_OPTIMIZATION"."
+
+DEBUG_OPTIMIZE ?= "1"
diff --git a/meta/conf/templates/default/local.conf.sample.extended b/meta/conf/templates/default/local.conf.sample.extended
index a898b18d59..ecf1855d2a 100644
--- a/meta/conf/templates/default/local.conf.sample.extended
+++ b/meta/conf/templates/default/local.conf.sample.extended
@@ -67,7 +67,7 @@
 #
 # Uncomment this to change the optimization to make debugging easer, at the
 # possible cost of performance.
-# DEBUG_BUILD = "1"
+# OE_FRAGMENTS += "core/yocto/debug-optimize"
 #
 # Uncomment this to disable the stripping of the installed binaries
 # INHIBIT_PACKAGE_STRIP = "1"
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 63414196fa..b3c5be11d6 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -60,8 +60,8 @@ COMPATIBLE_HOST:mipsarchn64 = "null"
 COMPATIBLE_HOST:riscv32 = "null"
 
 # Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
-# upstream states qemu doesn't work without optimization
-DEBUG_BUILD = "0"
+# upstream states qemu doesn't work with debug friendly optimization
+DEBUG_OPTIMIZE = "0"
 
 do_install:append() {
     # Prevent QA warnings about installed ${localstatedir}/run
-- 
2.34.1



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

* [PATCH v7 2/6] debug-optimize.inc: collect debug optimization tuning configuration
  2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
@ 2025-12-22 14:53 ` Hongxu Jia
  2025-12-22 14:54 ` [PATCH v7 3/6] debug-optimize.inc: override MESON_BUILDTYPE for target Hongxu Jia
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Hongxu Jia @ 2025-12-22 14:53 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt, richard.purdie

The modern compilers and code seem to require extra steps to avoid DEBUG errors,
Move debug tuning configuration from recipes to an include file to address these
errors.

Drop `:remove' operation on variable, override variables directly

Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/conf/distro/include/debug-optimize.inc   | 37 +++++++++++++++++++
 meta/recipes-connectivity/kea/kea_3.0.1.bb    | 10 -----
 .../debugedit/debugedit_5.2.bb                |  2 -
 meta/recipes-devtools/gcc/gcc-sanitizers.inc  |  3 --
 .../python/python3-lxml_6.0.2.bb              | 12 ------
 meta/recipes-extended/bash/bash_5.3.bb        |  3 --
 meta/recipes-extended/mdadm/mdadm_4.4.bb      |  2 -
 .../jpeg/libjpeg-turbo_3.1.2.bb               |  3 --
 .../vulkan-validation-layers_1.4.328.1.bb     |  2 -
 meta/recipes-kernel/lttng/lttng-ust_2.14.0.bb |  1 -
 meta/recipes-kernel/perf/perf.bb              |  2 -
 meta/recipes-sato/webkit/webkitgtk_2.50.0.bb  |  3 +-
 meta/recipes-support/vim/vim_9.1.bb           |  2 +-
 13 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/meta/conf/distro/include/debug-optimize.inc b/meta/conf/distro/include/debug-optimize.inc
index b5fb3bbf78..c11d792094 100644
--- a/meta/conf/distro/include/debug-optimize.inc
+++ b/meta/conf/distro/include/debug-optimize.inc
@@ -3,3 +3,40 @@ DEBUG_OPTIMIZATION ?= "-Og ${DEBUG_LEVELFLAG}"
 SELECTED_OPTIMIZATION ?= "${DEBUG_OPTIMIZATION}"
 # compiler flags for native/nativesdk
 BUILD_OPTIMIZATION ?= "-Og -g"
+
+# The modern compilers and code seem to require extra steps to avoid DEBUG errors,
+# this file collects debug tuning configuration to address DEBUG errors.
+
+DEBUG_OPTIMIZATION:append:pn-perf = " -Wno-error=maybe-uninitialized"
+DEBUG_OPTIMIZATION:append:armv4:pn-libjpeg-turbo = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+DEBUG_OPTIMIZATION:append:armv5:pn-libjpeg-turbo = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+DEBUG_OPTIMIZATION:append:armv4:pn-bash = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+DEBUG_OPTIMIZATION:append:armv5:pn-bash = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+DEBUG_OPTIMIZATION:append:pn-mdadm = " -Wno-error"
+DEBUG_OPTIMIZATION:mips:pn-kea = "-O ${DEBUG_LEVELFLAG}"
+DEBUG_OPTIMIZATION:mipsel:pn-kea = "-O ${DEBUG_LEVELFLAG}"
+# {standard input}: Assembler messages:
+# {standard input}:1488805: Error: branch out of range
+DEBUG_OPTIMIZATION:mips:pn-python3-lxml = "-O ${DEBUG_LEVELFLAG}"
+DEBUG_OPTIMIZATION:mipsel:pn-python3-lxml = "-O ${DEBUG_LEVELFLAG}"
+# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+DEBUG_OPTIMIZATION:append:pn-gcc-sanitizers = " -Wno-error"
+
+BUILD_OPTIMIZATION:mips:pn-kea = "-O -g"
+BUILD_OPTIMIZATION:mipsel:pn-kea = "-O -g"
+# {standard input}: Assembler messages:
+# {standard input}:1488805: Error: branch out of range
+BUILD_OPTIMIZATION:mips:pn-python3-lxml = "-O -g"
+BUILD_OPTIMIZATION:mipsel:pn-python3-lxml = "-O -g"
+
+CPPFLAGS:append:arm:pn-lttng-ust = " -DUATOMIC_NO_LINK_ERROR"
+
+OECMAKE_WEBKIT_NO_INLINE_HINTS:pn-webkitgtk = "-DWEBKIT_NO_INLINE_HINTS=ON"
+
+EXTRA_OECONF:append:pn-debugedit = " --disable-inlined-xxhash"
+EXTRA_OECONF:append:pn-debugedit-native = " --disable-inlined-xxhash"
+EXTRA_OECONF:append:pn-nativesdk-debugedit = " --disable-inlined-xxhash"
+
+lcl_maybe_fortify:pn-vim = ""
+
+CXXFLAGS:append:pn-vulkan-validation-layers = " -DXXH_NO_INLINE_HINTS=1"
diff --git a/meta/recipes-connectivity/kea/kea_3.0.1.bb b/meta/recipes-connectivity/kea/kea_3.0.1.bb
index 2fdfe27f77..6771953b9e 100644
--- a/meta/recipes-connectivity/kea/kea_3.0.1.bb
+++ b/meta/recipes-connectivity/kea/kea_3.0.1.bb
@@ -35,16 +35,6 @@ INITSCRIPT_PARAMS = "defaults 30"
 SYSTEMD_SERVICE:${PN} = "kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service"
 SYSTEMD_AUTO_ENABLE = "disable"
 
-DEBUG_OPTIMIZATION:remove:mips = " -Og"
-DEBUG_OPTIMIZATION:append:mips = " -O"
-BUILD_OPTIMIZATION:remove:mips = " -Og"
-BUILD_OPTIMIZATION:append:mips = " -O"
-
-DEBUG_OPTIMIZATION:remove:mipsel = " -Og"
-DEBUG_OPTIMIZATION:append:mipsel = " -O"
-BUILD_OPTIMIZATION:remove:mipsel = " -Og"
-BUILD_OPTIMIZATION:append:mipsel = " -O"
-
 CXXFLAGS:remove = "-fvisibility-inlines-hidden"
 
 do_configure:prepend() {
diff --git a/meta/recipes-devtools/debugedit/debugedit_5.2.bb b/meta/recipes-devtools/debugedit/debugedit_5.2.bb
index 76c54ba63d..4ac6cab559 100644
--- a/meta/recipes-devtools/debugedit/debugedit_5.2.bb
+++ b/meta/recipes-devtools/debugedit/debugedit_5.2.bb
@@ -22,8 +22,6 @@ inherit pkgconfig autotools multilib_script
 
 RDEPENDS:${PN} += "bash elfutils-binutils"
 
-EXTRA_OECONF = "${@oe.utils.vartrue('DEBUG_BUILD', '--disable-inlined-xxhash', '', d)}"
-
 BBCLASSEXTEND = "native nativesdk"
 
 MULTILIB_SCRIPTS = "${PN}:${bindir}/find-debuginfo"
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
index 6c81d30243..f4727ee6db 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers.inc
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -54,9 +54,6 @@ INHIBIT_DEFAULT_DEPS = "1"
 ALLOW_EMPTY:${PN} = "1"
 DEPENDS = "virtual/crypt gcc-runtime virtual/cross-cc"
 
-# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
-DEBUG_OPTIMIZATION:append = " -Wno-error"
-
 BBCLASSEXTEND = "nativesdk"
 
 PACKAGES = "${PN} ${PN}-dbg"
diff --git a/meta/recipes-devtools/python/python3-lxml_6.0.2.bb b/meta/recipes-devtools/python/python3-lxml_6.0.2.bb
index 876fda93b6..178908e3b2 100644
--- a/meta/recipes-devtools/python/python3-lxml_6.0.2.bb
+++ b/meta/recipes-devtools/python/python3-lxml_6.0.2.bb
@@ -23,18 +23,6 @@ SRC_URI[sha256sum] = "cd79f3367bd74b317dda655dc8fcfa304d9eb6e4fb06b7168c5cf27f96
 SRC_URI += "${PYPI_SRC_URI}"
 inherit pkgconfig pypi setuptools3
 
-# {standard input}: Assembler messages:
-# {standard input}:1488805: Error: branch out of range
-DEBUG_OPTIMIZATION:remove:mips = " -Og"
-DEBUG_OPTIMIZATION:append:mips = " -O"
-BUILD_OPTIMIZATION:remove:mips = " -Og"
-BUILD_OPTIMIZATION:append:mips = " -O"
-
-DEBUG_OPTIMIZATION:remove:mipsel = " -Og"
-DEBUG_OPTIMIZATION:append:mipsel = " -O"
-BUILD_OPTIMIZATION:remove:mipsel = " -Og"
-BUILD_OPTIMIZATION:append:mipsel = " -O"
-
 BBCLASSEXTEND = "native nativesdk"
 
 RDEPENDS:${PN} += "libxml2 libxslt python3-compression"
diff --git a/meta/recipes-extended/bash/bash_5.3.bb b/meta/recipes-extended/bash/bash_5.3.bb
index b50a48d28c..74671f5a56 100644
--- a/meta/recipes-extended/bash/bash_5.3.bb
+++ b/meta/recipes-extended/bash/bash_5.3.bb
@@ -15,9 +15,6 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \
 
 SRC_URI[tarball.sha256sum] = "0d5cd86965f869a26cf64f4b71be7b96f90a3ba8b3d74e27e8e9d9d5550f31ba"
 
-DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-
 CFLAGS += "-std=gnu17"
 # mkbuiltins.c is built with native toolchain and needs gnu17 as well:
 # http://errors.yoctoproject.org/Errors/Details/853016/
diff --git a/meta/recipes-extended/mdadm/mdadm_4.4.bb b/meta/recipes-extended/mdadm/mdadm_4.4.bb
index 26a60e4c1a..e81b8fdf3c 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.4.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.4.bb
@@ -39,8 +39,6 @@ EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CWFLAGS="" CXFLAGS="${CFLAGS}" SYSTEMD_DIR=${sys
                 BINDIR="${base_sbindir}" UDEVDIR="${nonarch_base_libdir}/udev" LDFLAGS="${LDFLAGS}" \
                 SYSROOT="${STAGING_DIR_TARGET}" STRIP='
 
-DEBUG_OPTIMIZATION:append = " -Wno-error"
-
 do_install() {
         oe_runmake 'DESTDIR=${D}' install install-systemd
         install -d ${D}/${sysconfdir}/
diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.2.bb b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.2.bb
index d4877bb92b..bc9d803f6b 100644
--- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.2.bb
+++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.2.bb
@@ -44,9 +44,6 @@ EXTRA_OECMAKE:append:class-target:powerpc = " ${@bb.utils.contains("TUNE_FEATURE
 EXTRA_OECMAKE:append:class-target:powerpc64 = " ${@bb.utils.contains("TUNE_FEATURES", "altivec", "", "-DWITH_SIMD=False", d)}"
 EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEATURES", "altivec", "", "-DWITH_SIMD=False", d)}"
 
-DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-
 # libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
 # <instantiation>:13:5: error: invalid token in expression
 # .if $17 != 0
diff --git a/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.4.328.1.bb b/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.4.328.1.bb
index 76a87398c4..84d75b8f7f 100644
--- a/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.4.328.1.bb
+++ b/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.4.328.1.bb
@@ -26,8 +26,6 @@ EXTRA_OECMAKE = "\
     -DSPIRV_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
     "
 
-CXXFLAGS:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '-DXXH_NO_INLINE_HINTS=1', '', d)}"
-
 PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr"
 PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland"
 
diff --git a/meta/recipes-kernel/lttng/lttng-ust_2.14.0.bb b/meta/recipes-kernel/lttng/lttng-ust_2.14.0.bb
index 1a15c5b420..0d4c67f0fa 100644
--- a/meta/recipes-kernel/lttng/lttng-ust_2.14.0.bb
+++ b/meta/recipes-kernel/lttng/lttng-ust_2.14.0.bb
@@ -16,7 +16,6 @@ inherit autotools lib_package manpages python3native pkgconfig
 include lttng-platforms.inc
 
 EXTRA_OECONF = "--disable-numa"
-CPPFLAGS:append:arm = "${@oe.utils.vartrue('DEBUG_BUILD', '-DUATOMIC_NO_LINK_ERROR', '', d)}"
 
 DEPENDS = "liburcu util-linux"
 RDEPENDS:${PN}-bin = "python3-core"
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index b69ba2ac12..3319ed5c78 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -422,8 +422,6 @@ FILES:${PN}-python = " \
                        "
 FILES:${PN}-perl = "${libexecdir}/perf-core/scripts/perl"
 
-DEBUG_OPTIMIZATION:append = " -Wno-error=maybe-uninitialized"
-
 PACKAGESPLITFUNCS =+ "perf_fix_sources"
 
 perf_fix_sources () {
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.50.0.bb b/meta/recipes-sato/webkit/webkitgtk_2.50.0.bb
index a8d0a094b3..b4173c08dd 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.50.0.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.50.0.bb
@@ -86,11 +86,12 @@ PACKAGECONFIG[gamepad] = "-DENABLE_GAMEPAD=ON,-DENABLE_GAMEPAD=OFF,libmanette"
 PACKAGECONFIG[sysprof-capture] = "-DUSE_SYSTEM_SYSPROF_CAPTURE=YES,-DUSE_SYSTEM_SYSPROF_CAPTURE=NO,sysprof"
 PACKAGECONFIG[speech] = "-DENABLE_SPEECH_SYNTHESIS=ON,-DENABLE_SPEECH_SYNTHESIS=OFF,flite"
 
+OECMAKE_WEBKIT_NO_INLINE_HINTS ??= "-DWEBKIT_NO_INLINE_HINTS=OFF"
 EXTRA_OECMAKE = " \
                  -DPORT=GTK \
                  ${@oe.utils.vartrue('GI_DATA_ENABLED', '-DENABLE_INTROSPECTION=ON', '-DENABLE_INTROSPECTION=OFF', d)} \
                  ${@oe.utils.vartrue('GIDOCGEN_ENABLED', '-DENABLE_DOCUMENTATION=ON', '-DENABLE_DOCUMENTATION=OFF', d)} \
-                 ${@oe.utils.vartrue('DEBUG_BUILD', '-DWEBKIT_NO_INLINE_HINTS=ON', '-DWEBKIT_NO_INLINE_HINTS=OFF', d)} \
+                 ${OECMAKE_WEBKIT_NO_INLINE_HINTS} \
                  -DENABLE_MINIBROWSER=ON \
                  -DENABLE_BUBBLEWRAP_SANDBOX=OFF \
                  -DUSE_GTK4=ON \
diff --git a/meta/recipes-support/vim/vim_9.1.bb b/meta/recipes-support/vim/vim_9.1.bb
index fee9f055e9..a24a863ba5 100644
--- a/meta/recipes-support/vim/vim_9.1.bb
+++ b/meta/recipes-support/vim/vim_9.1.bb
@@ -20,4 +20,4 @@ ALTERNATIVE_LINK_NAME[xxd] = "${bindir}/xxd"
 # We override the default in security_flags.inc because vim (not vim-tiny!) will abort
 # in many places for _FORTIFY_SOURCE=2.  Security flags become part of CC.
 #
-lcl_maybe_fortify = "${@oe.utils.conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE=1',d)}"
+lcl_maybe_fortify = "-D_FORTIFY_SOURCE=1"
-- 
2.34.1



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

* [PATCH v7 3/6] debug-optimize.inc: override MESON_BUILDTYPE for target
  2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
  2025-12-22 14:53 ` [PATCH v7 2/6] debug-optimize.inc: collect debug optimization tuning configuration Hongxu Jia
@ 2025-12-22 14:54 ` Hongxu Jia
  2025-12-22 14:54 ` [PATCH v7 4/6] debug-optimize.inc: override CARGO_BUILD_MODE and CARGO_BUILD_DIR " Hongxu Jia
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Hongxu Jia @ 2025-12-22 14:54 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt, richard.purdie

The debug-optimize.inc is used to collect debug optimization configuration,
override MESON_BUILDTYPE for target when debug optimization is enabled
(fragment core/yocto/debug-optimize)

Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-recipe/meson.bbclass           | 3 +--
 meta/conf/distro/include/debug-optimize.inc | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
index 2c098771fe..0b857ef22a 100644
--- a/meta/classes-recipe/meson.bbclass
+++ b/meta/classes-recipe/meson.bbclass
@@ -25,8 +25,7 @@ MESON_TARGET ?= ""
 # Since 0.60.0 you can specify custom tags to install
 MESON_INSTALL_TAGS ?= ""
 
-MESON_BUILDTYPE ?= "${@oe.utils.vartrue('DEBUG_BUILD', 'debug', 'plain', d)}"
-MESON_BUILDTYPE[vardeps] += "DEBUG_BUILD"
+MESON_BUILDTYPE ??= "plain"
 
 MESONOPTS = " --buildtype ${MESON_BUILDTYPE} \
               --prefix ${prefix} \
diff --git a/meta/conf/distro/include/debug-optimize.inc b/meta/conf/distro/include/debug-optimize.inc
index c11d792094..3f22aebbab 100644
--- a/meta/conf/distro/include/debug-optimize.inc
+++ b/meta/conf/distro/include/debug-optimize.inc
@@ -40,3 +40,6 @@ EXTRA_OECONF:append:pn-nativesdk-debugedit = " --disable-inlined-xxhash"
 lcl_maybe_fortify:pn-vim = ""
 
 CXXFLAGS:append:pn-vulkan-validation-layers = " -DXXH_NO_INLINE_HINTS=1"
+
+# For meson.bbclass
+MESON_BUILDTYPE:class-target ?= "debug"
-- 
2.34.1



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

* [PATCH v7 4/6] debug-optimize.inc: override CARGO_BUILD_MODE and CARGO_BUILD_DIR for target
  2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
  2025-12-22 14:53 ` [PATCH v7 2/6] debug-optimize.inc: collect debug optimization tuning configuration Hongxu Jia
  2025-12-22 14:54 ` [PATCH v7 3/6] debug-optimize.inc: override MESON_BUILDTYPE for target Hongxu Jia
@ 2025-12-22 14:54 ` Hongxu Jia
  2025-12-22 14:54 ` [PATCH v7 5/6] Clean up compiler optimization variable FULL_OPTIMIZATION Hongxu Jia
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Hongxu Jia @ 2025-12-22 14:54 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt, richard.purdie

Rename BUILD_MODE and BUILD_DIR with CARGO prefix, then in debug-optimize.inc,
override CARGO_BUILD_MODE and CARGO_BUILD_DIR for target when debug optimization
is enabled (fragment core/yocto/debug-optimize)

Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-recipe/cargo.bbclass                      | 8 ++++----
 meta/conf/distro/include/debug-optimize.inc            | 4 ++++
 meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.9.0.bb | 4 ++--
 meta/recipes-devtools/rust/libstd-rs_1.91.1.bb         | 4 ++--
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/meta/classes-recipe/cargo.bbclass b/meta/classes-recipe/cargo.bbclass
index 2dd28e95d3..eff28b323a 100644
--- a/meta/classes-recipe/cargo.bbclass
+++ b/meta/classes-recipe/cargo.bbclass
@@ -31,18 +31,18 @@ B = "${WORKDIR}/build"
 export RUST_BACKTRACE = "1"
 
 RUSTFLAGS ??= ""
-BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
+CARGO_BUILD_MODE ??= "--release"
 # --frozen flag will prevent network access (which is required since only
 # the do_fetch step is authorized to access network)
 # and will require an up to date Cargo.lock file.
 # This force the package being built to already ship a Cargo.lock, in the end
 # this is what we want, at least, for reproducibility of the build.
-CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${CARGO_MANIFEST_PATH}"
+CARGO_BUILD_FLAGS = "-v --frozen --target ${RUST_HOST_SYS} ${CARGO_BUILD_MODE} --manifest-path=${CARGO_MANIFEST_PATH}"
 
 # This is based on the content of CARGO_BUILD_FLAGS and generally will need to
 # change if CARGO_BUILD_FLAGS changes.
-BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_TARGET_SUBDIR = "${RUST_HOST_SYS}/${BUILD_DIR}"
+CARGO_BUILD_DIR ??= "release"
+CARGO_TARGET_SUBDIR = "${RUST_HOST_SYS}/${CARGO_BUILD_DIR}"
 oe_cargo_build () {
 	export RUSTFLAGS="${RUSTFLAGS}"
 	bbnote "Using rust targets from ${RUST_TARGET_PATH}"
diff --git a/meta/conf/distro/include/debug-optimize.inc b/meta/conf/distro/include/debug-optimize.inc
index 3f22aebbab..55f35dd7c6 100644
--- a/meta/conf/distro/include/debug-optimize.inc
+++ b/meta/conf/distro/include/debug-optimize.inc
@@ -43,3 +43,7 @@ CXXFLAGS:append:pn-vulkan-validation-layers = " -DXXH_NO_INLINE_HINTS=1"
 
 # For meson.bbclass
 MESON_BUILDTYPE:class-target ?= "debug"
+
+# For cargo.bbclass
+CARGO_BUILD_MODE:class-target ?= ""
+CARGO_BUILD_DIR:class-target ?= "debug"
diff --git a/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.9.0.bb b/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.9.0.bb
index 577acfdc86..9de4a07aeb 100644
--- a/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.9.0.bb
+++ b/meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.9.0.bb
@@ -27,7 +27,7 @@ CARGO_INSTALL_LIBRARIES = "1"
 do_compile:prepend () {
 	# rpm-sequoia.pc is generated in the source directory
 	# but the target directory does not exist there.
-	mkdir -p ${S}/target/${BUILD_DIR}
+	mkdir -p ${S}/target/${CARGO_BUILD_DIR}
 
 	# From rpm-sequoia's README.md:
 	#
@@ -59,7 +59,7 @@ do_install:append () {
 
 	# rpm-sequoia does not install its pkgconfig file. Do it manually.
 	mkdir -p ${D}${libdir}/pkgconfig
-	install -m644 ${S}/target/${BUILD_DIR}/rpm-sequoia.pc ${D}${libdir}/pkgconfig
+	install -m644 ${S}/target/${CARGO_BUILD_DIR}/rpm-sequoia.pc ${D}${libdir}/pkgconfig
 }
 
 do_install_ptest:append () {
diff --git a/meta/recipes-devtools/rust/libstd-rs_1.91.1.bb b/meta/recipes-devtools/rust/libstd-rs_1.91.1.bb
index 8af93bec57..30875200e4 100644
--- a/meta/recipes-devtools/rust/libstd-rs_1.91.1.bb
+++ b/meta/recipes-devtools/rust/libstd-rs_1.91.1.bb
@@ -44,8 +44,8 @@ do_install () {
     # With the incremental build support added in 1.24, the libstd deps directory also includes dependency
     # files that get installed. Those are really only needed to incrementally rebuild the libstd library
     # itself and don't need to be installed.
-    rm -f ${B}/target/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d
-    cp ${B}/target/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir}
+    rm -f ${B}/target/${RUST_TARGET_SYS}/${CARGO_BUILD_DIR}/deps/*.d
+    cp ${B}/target/${RUST_TARGET_SYS}/${CARGO_BUILD_DIR}/deps/* ${D}${rustlibdir}
 }
 
 BBCLASSEXTEND = "nativesdk"
-- 
2.34.1



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

* [PATCH v7 5/6] Clean up compiler optimization variable FULL_OPTIMIZATION
  2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
                   ` (2 preceding siblings ...)
  2025-12-22 14:54 ` [PATCH v7 4/6] debug-optimize.inc: override CARGO_BUILD_MODE and CARGO_BUILD_DIR " Hongxu Jia
@ 2025-12-22 14:54 ` Hongxu Jia
  2025-12-22 14:54 ` [PATCH v7 6/6] Clean up compiler optimization variable DEBUG_OPTIMIZATION Hongxu Jia
  2026-01-05 21:30 ` [OE-core] [PATCH v7 1/6] distro/include: rework debug friendly optimization adrian.freihofer
  5 siblings, 0 replies; 8+ messages in thread
From: Hongxu Jia @ 2025-12-22 14:54 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt, richard.purdie

In bitbake.conf, remove FULL_OPTIMIZATION, set "-O2 ${DEBUG_LEVELFLAG}"
to SELECTED_OPTIMIZATION directly

In mesa.inc, due to llvmpipe is slow if compiled with
-fomit-frame-pointer (e.g. -O2), set -fno-omit-frame-pointer
to TARGET_CFLAGS only if option -O2 existed

Correct typo in clang.patch

In recipe harfbuzz, use SELECTED_OPTIMIZATION to instead of
FULL_OPTIMIZATION

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/conf/bitbake.conf                            | 3 +--
 meta/conf/documentation.conf                      | 3 +--
 meta/recipes-graphics/harfbuzz/harfbuzz_11.5.1.bb | 2 +-
 meta/recipes-graphics/mesa/mesa.inc               | 2 +-
 meta/recipes-multimedia/lame/lame/clang.patch     | 2 +-
 5 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 653d396c79..c4e9b60ac3 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -659,8 +659,7 @@ DEBUG_PREFIX_MAP ?= "${DEBUG_PREFIX_MAP_EXTRA} \
 "
 DEBUG_LEVELFLAG ?= "-g"
 
-FULL_OPTIMIZATION ??= "-O2 ${DEBUG_LEVELFLAG}"
-SELECTED_OPTIMIZATION ??= "${FULL_OPTIMIZATION}"
+SELECTED_OPTIMIZATION ??= "-O2 ${DEBUG_LEVELFLAG}"
 # compiler flags for native/nativesdk
 BUILD_OPTIMIZATION ??= "-O2"
 
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 956d4a79a6..7d2163bae0 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -178,7 +178,6 @@ FILESPATH[doc] = "The default set of directories the OpenEmbedded build system u
 FILESYSTEM_PERMS_TABLES[doc] = "Allows you to define your own file permissions settings table as part of your configuration for the packaging process."
 FONT_EXTRA_RDEPENDS[doc] = "When a recipe inherits the fontcache class, this variable specifies runtime dependencies for font packages. This variable defaults to 'fontconfig-utils'."
 FONT_PACKAGES[doc] = "When a recipe inherits the fontcache class, this variable identifies packages containing font files that need to be cached by Fontconfig."
-FULL_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '-O2 ${DEBUG_LEVELFLAG}'."
 
 #G
 
@@ -370,7 +369,7 @@ SDK_OUTPUT[doc] = "The location used by the OpenEmbedded build system when creat
 SDKIMAGE_FEATURES[doc] = "Equivalent to IMAGE_FEATURES. However, this variable applies to the SDK generated from an image using the command 'bitbake -c populate_sdk imagename'."
 SDKMACHINE[doc] = "Specifies the architecture (i.e. i686 or x86_64) for which to build SDK and ADT items."
 SECTION[doc] = "The section in which packages should be categorized. Package management utilities can make use of this variable."
-SELECTED_OPTIMIZATION[doc] = "The variable takes the value of FULL_OPTIMIZATION unless fragment 'core/yocto/debug-optimize' is enabled. In this case, the value of DEBUG_OPTIMIZATION is used."
+SELECTED_OPTIMIZATION[doc] = "The variable takes the value of '-O2 ${DEBUG_LEVELFLAG}' unless fragment 'core/yocto/debug-optimize' is enabled. In this case, the value of DEBUG_OPTIMIZATION is used."
 SERIAL_CONSOLES[doc] = "Defines the serial consoles (TTYs) to enable using getty."
 SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS[doc] = "A list of recipe dependencies that should not be used to determine signatures of tasks from one recipe when they depend on tasks from another recipe."
 SIGGEN_EXCLUDERECIPES_ABISAFE[doc] = "A list of recipes that are completely stable and will never change."
diff --git a/meta/recipes-graphics/harfbuzz/harfbuzz_11.5.1.bb b/meta/recipes-graphics/harfbuzz/harfbuzz_11.5.1.bb
index dd30c1237d..72840417f2 100644
--- a/meta/recipes-graphics/harfbuzz/harfbuzz_11.5.1.bb
+++ b/meta/recipes-graphics/harfbuzz/harfbuzz_11.5.1.bb
@@ -21,7 +21,7 @@ GTKDOC_MESON_ENABLE_FLAG = 'enabled'
 GTKDOC_MESON_DISABLE_FLAG = 'disabled'
 
 # As per upstream CONFIG.md, it is recommended to always build with -Os.
-FULL_OPTIMIZATION = "-Os ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION ?= "-Os ${DEBUG_LEVELFLAG}"
 
 EXTRA_OEMESON = "-Dtests=disabled"
 
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 835e4d46ea..24d2435f00 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -221,7 +221,7 @@ PACKAGECONFIG[video-codecs] = "-Dvideo-codecs=${VIDEO_CODECS}, -Dvideo-codecs=''
 PACKAGECONFIG[teflon] = "-Dteflon=true, -Dteflon=false"
 
 # llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
-FULL_OPTIMIZATION:append = " -fno-omit-frame-pointer"
+TARGET_CFLAGS += "${@bb.utils.contains('SELECTED_OPTIMIZATION', '-O2', '-fno-omit-frame-pointer', '', d)}"
 
 CFLAGS:append:armv5 = " -DMISSING_64BIT_ATOMICS"
 CFLAGS:append:armv6 = " -DMISSING_64BIT_ATOMICS"
diff --git a/meta/recipes-multimedia/lame/lame/clang.patch b/meta/recipes-multimedia/lame/lame/clang.patch
index 116000c577..183a9d3212 100644
--- a/meta/recipes-multimedia/lame/lame/clang.patch
+++ b/meta/recipes-multimedia/lame/lame/clang.patch
@@ -9,7 +9,7 @@ and target hardware aligns, and leads to some amusing errors:
 	unknown target CPU 'neoverse-n1'
 	note: valid target CPU values are: i386, i486, ...
 
-Move the HAVE_CLANG block up into the FULL_OPTIMIZATION case, alongside
+Move the HAVE_CLANG block up into the OPTIMIZATION case, alongside
 HAVE_GCC.  This option is never enabled (as it's basically "use native")
 so resolves the build failure.
 
-- 
2.34.1



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

* [PATCH v7 6/6] Clean up compiler optimization variable DEBUG_OPTIMIZATION
  2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
                   ` (3 preceding siblings ...)
  2025-12-22 14:54 ` [PATCH v7 5/6] Clean up compiler optimization variable FULL_OPTIMIZATION Hongxu Jia
@ 2025-12-22 14:54 ` Hongxu Jia
  2026-01-05 21:30 ` [OE-core] [PATCH v7 1/6] distro/include: rework debug friendly optimization adrian.freihofer
  5 siblings, 0 replies; 8+ messages in thread
From: Hongxu Jia @ 2025-12-22 14:54 UTC (permalink / raw)
  To: openembedded-core, peter.kjellerstedt, richard.purdie

Remove DEBUG_OPTIMIZATION, set "-Og ${DEBUG_LEVELFLAG}" to
SELECTED_OPTIMIZATION when debug optimization is enabled (fragment
core/yocto/debug-optimize)

Use SELECTED_OPTIMIZATION to instead of DEBUG_OPTIMIZATION
for debug optimization tuning configuration

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/conf/distro/include/debug-optimize.inc   | 25 +++++++++----------
 meta/conf/documentation.conf                  |  3 +--
 meta/conf/fragments/yocto/debug-optimize.conf |  2 +-
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/meta/conf/distro/include/debug-optimize.inc b/meta/conf/distro/include/debug-optimize.inc
index 55f35dd7c6..587c12721a 100644
--- a/meta/conf/distro/include/debug-optimize.inc
+++ b/meta/conf/distro/include/debug-optimize.inc
@@ -1,26 +1,25 @@
 # Override SELECTED_OPTIMIZATION and BUILD_OPTIMIZATION when fragment 'core/yocto/debug-optimize' is enabled.
-DEBUG_OPTIMIZATION ?= "-Og ${DEBUG_LEVELFLAG}"
-SELECTED_OPTIMIZATION ?= "${DEBUG_OPTIMIZATION}"
+SELECTED_OPTIMIZATION ?= "-Og ${DEBUG_LEVELFLAG}"
 # compiler flags for native/nativesdk
 BUILD_OPTIMIZATION ?= "-Og -g"
 
 # The modern compilers and code seem to require extra steps to avoid DEBUG errors,
 # this file collects debug tuning configuration to address DEBUG errors.
 
-DEBUG_OPTIMIZATION:append:pn-perf = " -Wno-error=maybe-uninitialized"
-DEBUG_OPTIMIZATION:append:armv4:pn-libjpeg-turbo = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-DEBUG_OPTIMIZATION:append:armv5:pn-libjpeg-turbo = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-DEBUG_OPTIMIZATION:append:armv4:pn-bash = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-DEBUG_OPTIMIZATION:append:armv5:pn-bash = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
-DEBUG_OPTIMIZATION:append:pn-mdadm = " -Wno-error"
-DEBUG_OPTIMIZATION:mips:pn-kea = "-O ${DEBUG_LEVELFLAG}"
-DEBUG_OPTIMIZATION:mipsel:pn-kea = "-O ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION:append:pn-perf = " -Wno-error=maybe-uninitialized"
+SELECTED_OPTIMIZATION:append:armv4:pn-libjpeg-turbo = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+SELECTED_OPTIMIZATION:append:armv5:pn-libjpeg-turbo = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+SELECTED_OPTIMIZATION:append:armv4:pn-bash = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+SELECTED_OPTIMIZATION:append:armv5:pn-bash = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+SELECTED_OPTIMIZATION:append:pn-mdadm = " -Wno-error"
+SELECTED_OPTIMIZATION:mips:pn-kea = "-O ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION:mipsel:pn-kea = "-O ${DEBUG_LEVELFLAG}"
 # {standard input}: Assembler messages:
 # {standard input}:1488805: Error: branch out of range
-DEBUG_OPTIMIZATION:mips:pn-python3-lxml = "-O ${DEBUG_LEVELFLAG}"
-DEBUG_OPTIMIZATION:mipsel:pn-python3-lxml = "-O ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION:mips:pn-python3-lxml = "-O ${DEBUG_LEVELFLAG}"
+SELECTED_OPTIMIZATION:mipsel:pn-python3-lxml = "-O ${DEBUG_LEVELFLAG}"
 # used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
-DEBUG_OPTIMIZATION:append:pn-gcc-sanitizers = " -Wno-error"
+SELECTED_OPTIMIZATION:append:pn-gcc-sanitizers = " -Wno-error"
 
 BUILD_OPTIMIZATION:mips:pn-kea = "-O -g"
 BUILD_OPTIMIZATION:mipsel:pn-kea = "-O -g"
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 7d2163bae0..94441416cd 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -129,7 +129,6 @@ CVE_CHECK_LAYER_INCLUDELIST[doc] = "Defines which layers to include during cve-c
 D[doc] = "The destination directory."
 DATE[doc] = "The date the build was started using YMD format."
 DATETIME[doc] = "The date and time the build was started."
-DEBUG_OPTIMIZATION[doc] = "The options to pass in TARGET_CFLAGS and CFLAGS when compiling a system for debugging. This variable defaults to '-Og ${DEBUG_LEVELFLAG}'."
 DEBUG_OPTIMIZE[doc] = "Specifies to build recipe with debugging friendly optimization. This influences the value of the SELECTED_OPTIMIZATION variable."
 DEFAULT_PREFERENCE[doc] = "Specifies a weak bias for recipe selection priority."
 DEPENDS[doc] = "Lists a recipe's build-time dependencies (i.e. other recipe files)."
@@ -369,7 +368,7 @@ SDK_OUTPUT[doc] = "The location used by the OpenEmbedded build system when creat
 SDKIMAGE_FEATURES[doc] = "Equivalent to IMAGE_FEATURES. However, this variable applies to the SDK generated from an image using the command 'bitbake -c populate_sdk imagename'."
 SDKMACHINE[doc] = "Specifies the architecture (i.e. i686 or x86_64) for which to build SDK and ADT items."
 SECTION[doc] = "The section in which packages should be categorized. Package management utilities can make use of this variable."
-SELECTED_OPTIMIZATION[doc] = "The variable takes the value of '-O2 ${DEBUG_LEVELFLAG}' unless fragment 'core/yocto/debug-optimize' is enabled. In this case, the value of DEBUG_OPTIMIZATION is used."
+SELECTED_OPTIMIZATION[doc] = "The variable takes the value of '-O2 ${DEBUG_LEVELFLAG}' unless fragment 'core/yocto/debug-optimize' is enabled. In this case, the value of '-Og ${DEBUG_LEVELFLAG}' is used."
 SERIAL_CONSOLES[doc] = "Defines the serial consoles (TTYs) to enable using getty."
 SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS[doc] = "A list of recipe dependencies that should not be used to determine signatures of tasks from one recipe when they depend on tasks from another recipe."
 SIGGEN_EXCLUDERECIPES_ABISAFE[doc] = "A list of recipes that are completely stable and will never change."
diff --git a/meta/conf/fragments/yocto/debug-optimize.conf b/meta/conf/fragments/yocto/debug-optimize.conf
index 000b5a50cd..afdb877479 100644
--- a/meta/conf/fragments/yocto/debug-optimize.conf
+++ b/meta/conf/fragments/yocto/debug-optimize.conf
@@ -2,6 +2,6 @@ BB_CONF_FRAGMENT_SUMMARY = "Specifies to build recipes with debugging friendly o
 This influences the value of the SELECTED_OPTIMIZATION variable."
 BB_CONF_FRAGMENT_DESCRIPTION = "Enables full debug and backtrace capabilities for all programs \
 and libraries in the image, by modifying the SELECTED_OPTIMIZATION variable, \
-setting it to "DEBUG_OPTIMIZATION"."
+setting it to '-Og ${DEBUG_LEVELFLAG}'."
 
 DEBUG_OPTIMIZE ?= "1"
-- 
2.34.1



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

* Re: [OE-core] [PATCH v7 1/6] distro/include: rework debug friendly optimization
  2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
                   ` (4 preceding siblings ...)
  2025-12-22 14:54 ` [PATCH v7 6/6] Clean up compiler optimization variable DEBUG_OPTIMIZATION Hongxu Jia
@ 2026-01-05 21:30 ` adrian.freihofer
  2026-01-06  4:54   ` [PATCH] devtool: clean up debug build Hongxu Jia
  5 siblings, 1 reply; 8+ messages in thread
From: adrian.freihofer @ 2026-01-05 21:30 UTC (permalink / raw)
  To: hongxu.jia, openembedded-core, mathieu.dubois-briand

Hi Hongxu, hi Mathieu

I guess this series is not complete. If I do a git grep on today's
master-next branch with this series applied:

openembedded-core$ git grep DEBUG_BUILD
  scripts/lib/devtool/ide_sdk.py:
    self.debug_build = recipe_d.getVar('DEBUG_BUILD')
  scripts/lib/devtool/ide_sdk.py:
    'You might want to add DEBUG_BUILD = "1" to %s. '
  scripts/lib/devtool/standard.py:
    f.write('DEBUG_BUILD = "1"\n')
  scripts/lib/devtool/standard.py:
    parser_modify.add_argument('--debug-build', action="store_true",
    help='Add DEBUG_BUILD = "1" to the modified recipe')

This breaks the patch from
https://lists.openembedded.org/g/openembedded-core/message/228633
which tries to add a test for remote debugging.

The issue looks like this:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3070

Breaking scripts/lib/devtool/standard.py:
    f.write('DEBUG_BUILD = "1"\n')
is at least an explanation for this issue. Since TDEBUG_BUILD = "1" is
now without any effect, the compiler removes the code where the test
adds the break point.


@Mathieu: would you mind
- dropping this series from your master-next branch until this is fixed
- bring the patch from my v1 series back?
  (v2 seams to be worse than v1)
https://patchwork.yoctoproject.org/project/oe-core/patch/20251230084720.2371227-14-adrian.freihofer@siemens.com/

Of course, I can also send a v3 if this would be easier for you.

Thank you.

Regards,
Adrian


> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#228304):
> https://lists.openembedded.org/g/openembedded-core/message/228304
> Mute This Topic: https://lists.openembedded.org/mt/116902148/4454582
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/openembedded-core/unsub [
> adrian.freihofer@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-


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

* [PATCH] devtool: clean up debug build
  2026-01-05 21:30 ` [OE-core] [PATCH v7 1/6] distro/include: rework debug friendly optimization adrian.freihofer
@ 2026-01-06  4:54   ` Hongxu Jia
  0 siblings, 0 replies; 8+ messages in thread
From: Hongxu Jia @ 2026-01-06  4:54 UTC (permalink / raw)
  To: openembedded-core, adrian.freihofer, mathieu.dubois-briand

Due to we rework debug friendly optimization, rename DEBUG_BUILD
to DEBUG_OPTIMIZE. Then:

- s/DEBUG_BUILD/DEBUG_OPTIMIZE/g

- s/debug-build/debug-optimize/g

- s/debug_build/debug_optimize/g

Note, for specific recipe, we do not use
  OE_FRAGMENTS += "core/yocto/debug-optimize"
in recipe

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py |  2 +-
 scripts/lib/devtool/ide_sdk.py          | 10 +++++-----
 scripts/lib/devtool/standard.py         |  6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index cf5ac6e9d7..fc7f119063 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -2563,7 +2563,7 @@ class DevtoolIdeSdkTests(DevtoolBase):
         self.track_for_cleanup(tempdir)
         self.add_command_to_tearDown('bitbake -c clean %s' % recipe_name)
 
-        result = runCmd('devtool modify %s -x %s --debug-build' % (recipe_name, tempdir))
+        result = runCmd('devtool modify %s -x %s --debug-optimize' % (recipe_name, tempdir))
         self.assertExists(os.path.join(tempdir, build_file),
                           'Extracted source could not be found')
         self.assertExists(os.path.join(self.workspacedir, 'conf',
diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index 87a4c13ec5..06e2a6f9d8 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -289,7 +289,7 @@ class RecipeModified:
         self.bitbakepath = None
         self.bpn = None
         self.d = None
-        self.debug_build = None
+        self.debug_optimize = None
         self.fakerootcmd = None
         self.fakerootenv = None
         self.libdir = None
@@ -351,7 +351,7 @@ class RecipeModified:
         self.bpn = recipe_d.getVar('BPN')
         self.cxx = recipe_d.getVar('CXX')
         self.d = recipe_d.getVar('D')
-        self.debug_build = recipe_d.getVar('DEBUG_BUILD')
+        self.debug_optimize = recipe_d.getVar('DEBUG_OPTIMIZE')
         self.fakerootcmd = recipe_d.getVar('FAKEROOTCMD')
         self.fakerootenv = recipe_d.getVar('FAKEROOTENV')
         self.libdir = recipe_d.getVar('libdir')
@@ -917,11 +917,11 @@ def ide_setup(args, config, basepath, workspace):
             ide.setup_modified_recipe(
                 args, recipe_image, recipe_modified)
 
-            if recipe_modified.debug_build != '1':
+            if recipe_modified.debug_optimize != '1':
                 logger.warn(
                     'Recipe %s is compiled with release build configuration. '
-                    'You might want to add DEBUG_BUILD = "1" to %s. '
-                    'Note that devtool modify --debug-build can do this automatically.',
+                    'You might want to add DEBUG_OPTIMIZE = "1" to %s. '
+                    'Note that devtool modify --debug-optimize can do this automatically.',
                     recipe_modified.name, recipe_modified.bbappend)
     else:
         raise DevtoolError("Must not end up here.")
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 1fd5947c41..a7685401e9 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -970,8 +970,8 @@ def modify(args, config, basepath, workspace):
                     if branch == args.branch:
                         continue
                     f.write('# patches_%s: %s\n' % (branch, ','.join(branch_patches[branch])))
-            if args.debug_build:
-                f.write('\nDEBUG_BUILD = "1"\n')
+            if args.debug_optimize:
+                f.write('\nDEBUG_OPTIMIZE = "1"\n')
 
         update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn])
 
@@ -2320,7 +2320,7 @@ def register_commands(subparsers, context):
     parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")')
     parser_modify.add_argument('--no-overrides', '-O', action="store_true", help='Do not create branches for other override configurations')
     parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true")
-    parser_modify.add_argument('--debug-build', action="store_true", help='Add DEBUG_BUILD = "1" to the modified recipe')
+    parser_modify.add_argument('--debug-optimize', action="store_true", help='Add DEBUG_OPTIMIZE = "1" to the modified recipe')
     parser_modify.set_defaults(func=modify, fixed_setup=context.fixed_setup)
 
     parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe',
-- 
2.34.1



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

end of thread, other threads:[~2026-01-06  4:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 14:53 [PATCH v7 1/6] distro/include: rework debug friendly optimization Hongxu Jia
2025-12-22 14:53 ` [PATCH v7 2/6] debug-optimize.inc: collect debug optimization tuning configuration Hongxu Jia
2025-12-22 14:54 ` [PATCH v7 3/6] debug-optimize.inc: override MESON_BUILDTYPE for target Hongxu Jia
2025-12-22 14:54 ` [PATCH v7 4/6] debug-optimize.inc: override CARGO_BUILD_MODE and CARGO_BUILD_DIR " Hongxu Jia
2025-12-22 14:54 ` [PATCH v7 5/6] Clean up compiler optimization variable FULL_OPTIMIZATION Hongxu Jia
2025-12-22 14:54 ` [PATCH v7 6/6] Clean up compiler optimization variable DEBUG_OPTIMIZATION Hongxu Jia
2026-01-05 21:30 ` [OE-core] [PATCH v7 1/6] distro/include: rework debug friendly optimization adrian.freihofer
2026-01-06  4:54   ` [PATCH] devtool: clean up debug build Hongxu Jia

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