diff mbox series

[v7,6/6] Clean up compiler optimization variable DEBUG_OPTIMIZATION

Message ID 20251222145403.3688113-6-hongxu.jia@windriver.com
State New
Headers show
Series [v7,1/6] distro/include: rework debug friendly optimization | expand

Commit Message

Hongxu Jia Dec. 22, 2025, 2:54 p.m. UTC
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 mbox series

Patch

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"