From 1cf0974ad242f7eb2815a4ef0e3e5b6507ca56ea Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 12 Jul 2024 07:35:48 +0100 Subject: bitbake.conf: Further cleanup compiler optimization flags Move the -pipe option out of the optimization flags and directly into the flags variables since we always use it now. Also move the debug prefix mapping there to match the nativesdk case which already does this. Fix the documentation and two recipe usages to match the change. (From OE-Core rev: 9badf68d78d995f7d5d4cf27e045f029fc6d4044) Signed-off-by: Richard Purdie --- meta/conf/bitbake.conf | 15 ++++++++------- meta/conf/documentation.conf | 4 ++-- meta/recipes-core/ovmf/ovmf_git.bb | 2 +- meta/recipes-devtools/valgrind/valgrind_3.23.0.bb | 2 +- meta/recipes-kernel/perf/perf.bb | 7 +++---- meta/recipes-sato/webkit/webkitgtk_2.44.1.bb | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 02fe872d2c..5c875f34f8 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -610,10 +610,10 @@ BUILDSDK_CPPFLAGS = "" export CPPFLAGS = "${TARGET_CPPFLAGS}" TARGET_CPPFLAGS = "" -export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}" -BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION} ${DEBUG_PREFIX_MAP}" +export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION} -pipe" +BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION} ${DEBUG_PREFIX_MAP} -pipe" export CFLAGS = "${TARGET_CFLAGS}" -TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}" +TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP} -pipe" export BUILD_CXXFLAGS = "${BUILD_CFLAGS}" BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}" @@ -663,13 +663,14 @@ DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \ -fmacro-prefix-map=${STAGING_DIR_HOST}= \ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ " -DEBUG_FLAGS ?= "-g ${DEBUG_PREFIX_MAP}" +DEBUG_LEVELFLAG ?= "-g" -FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" -DEBUG_OPTIMIZATION = "-Og ${DEBUG_FLAGS} -pipe" +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" -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)} -pipe" +# compiler flags for native/nativesdk +BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}" BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD" ################################################################## diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index b0591881ba..155353eafc 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -132,7 +132,7 @@ 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_FLAGS} -pipe'." +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}'." 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." @@ -180,7 +180,7 @@ 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 -pipe ${DEBUG_FLAGS}'." +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 diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb index 35ca8d1834..085574c0cb 100644 --- a/meta/recipes-core/ovmf/ovmf_git.bb +++ b/meta/recipes-core/ovmf/ovmf_git.bb @@ -55,7 +55,7 @@ DEPENDS = "nasm-native acpica-native ovmf-native util-linux-native" EDK_TOOLS_DIR="edk2_basetools" # OVMF has trouble building with the default optimization of -O2. -BUILD_OPTIMIZATION="-pipe" +BUILD_OPTIMIZATION = "" # OVMF supports IA only, although it could conceivably support ARM someday. COMPATIBLE_HOST:class-target='(i.86|x86_64).*' diff --git a/meta/recipes-devtools/valgrind/valgrind_3.23.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.23.0.bb index ad9e26cb6b..494a3c0df9 100644 --- a/meta/recipes-devtools/valgrind/valgrind_3.23.0.bb +++ b/meta/recipes-devtools/valgrind/valgrind_3.23.0.bb @@ -88,7 +88,7 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" # to -O2 but uses -O0 for some specific test apps etc. Passing our own flags # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it # which fixes build path issue in DWARF. -SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" +SELECTED_OPTIMIZATION = "${DEBUG_LEVELFLAG}" # Split out various helper scripts to separate packages to avoid the # main package depending on perl and python. diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index 058f887b86..ab2dc5ae62 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb @@ -76,11 +76,10 @@ LDFLAGS="-ldl -lutil" # Perf's build system adds its own optimization flags for most TUs, # overriding the flags included here. But for some, perf does not add # any -O option, so ensure the distro's chosen optimization gets used -# for those. Since ${SELECTED_OPTIMIZATION} always includes -# ${DEBUG_FLAGS} which in turn includes ${DEBUG_PREFIX_MAP}, this also -# ensures perf is built with appropriate -f*-prefix-map options, +# for those. Also include ${DEBUG_PREFIX_MAP} which nsures perf is +# built with appropriate -f*-prefix-map options, # avoiding the 'buildpaths' QA warning. -TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}" EXTRA_OEMAKE = '\ V=1 \ diff --git a/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb b/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb index 29e12bb8c5..d927d81a43 100644 --- a/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb +++ b/meta/recipes-sato/webkit/webkitgtk_2.44.1.bb @@ -93,7 +93,7 @@ EXTRA_OECMAKE = " \ # Unless DEBUG_BUILD is enabled, pass -g1 to massively reduce the size of the # debug symbols (4.3GB to 700M at time of writing) -DEBUG_FLAGS:append = "${@oe.utils.vartrue('DEBUG_BUILD', '', ' -g1', d)}" +DEBUG_LEVELFLAG = "-g1" # Javascript JIT is not supported on ARC EXTRA_OECMAKE:append:arc = " -DENABLE_JIT=OFF " -- cgit v1.2.3-54-g00ecf