On Mon, Nov 23, 2020 at 11:04 AM Andrej Valek <[email protected]> wrote:
>
> This option allows correctly handle the release/debug flags separation in
> upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other
> recipes.
>
> Signed-off-by: Andrej Valek <[email protected]>
> Signed-off-by: Pascal Bach <[email protected]>
> Signed-off-by: Adrian Freihofer <[email protected]>
> ---
> meta/conf/bitbake.conf | 7 ++++---
> meta/conf/distro/include/security_flags.inc | 8 ++++----
> meta/conf/local.conf.sample.extended | 1 +
> meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
> 4 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 0d38eac094..5555093e24 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -569,7 +569,7 @@ TARGET_CPPFLAGS = ""
> export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
> BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION}
> ${DEBUG_PREFIX_MAP}"
> export CFLAGS = "${TARGET_CFLAGS}"
> -TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
> +TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}
> ${COMMON_OPTIMIZATION}"
>
> export BUILD_CXXFLAGS = "${BUILD_CFLAGS}"
> BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}"
> @@ -616,8 +616,9 @@ DEBUG_PREFIX_MAP ?=
> "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTEND
> DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
>
> # Disabled until the option works properly -feliminate-dwarf2-dups
> -FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
> -DEBUG_OPTIMIZATION = "-Og ${DEBUG_FLAGS} -pipe"
> +COMMON_OPTIMIZATION = "${DEBUG_FLAGS} -pipe"
> +FULL_OPTIMIZATION = "-O2"
> +DEBUG_OPTIMIZATION = "-Og"
> SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
SELECTED_OPTIMIZATION is a kind of final sum of flags that is seen by
recipes, there are more distro policies that append to it e.g.
security_flags
lto, etc and recipe space also relies on it for deducing option logic.
here we are moving some options, -pipe ${DEBUG_FLAGS} out into another
variable
COMMON_OPTIMIZATION but we do not add it back as it is but it seems
after this patch we will have two variables to look out for
SELECTED_OPTIMIZATION and COMMON_OPTIMIZATION which complicates
things. I would rather expect to make it simpler. Where there is one
final global flag set which becomes distro
policy.
> SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION
> DEBUG_BUILD"
> BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g
> -feliminate-unused-debug-types', '-O2', d)} -pipe"
> diff --git a/meta/conf/distro/include/security_flags.inc
> b/meta/conf/distro/include/security_flags.inc
> index 4e64eb99f9..60370eeb17 100644
> --- a/meta/conf/distro/include/security_flags.inc
> +++ b/meta/conf/distro/include/security_flags.inc
> @@ -63,7 +63,7 @@ SECURITY_STACK_PROTECTOR_pn-glibc-testsuite = ""
> # handled in recipes-graphics/xorg-driver/xorg-driver-common.inc
> SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}"
>
> -TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION}"
> -TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION}"
> -TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION}"
> -TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION}
> ${COMMON_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION}
> ${COMMON_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION}
> ${COMMON_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION}
> ${COMMON_OPTIMIZATION}"
> diff --git a/meta/conf/local.conf.sample.extended
> b/meta/conf/local.conf.sample.extended
> index 5ece522fa8..51cea43b9e 100644
> --- a/meta/conf/local.conf.sample.extended
> +++ b/meta/conf/local.conf.sample.extended
> @@ -99,6 +99,7 @@
> #
> # PROFILE_OPTIMIZATION = "-pg"
> # SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}"
> +# COMMON_OPTIMIZATION = ""
> # LDFLAGS =+ "-pg"
>
> # TCMODE controls the characteristics of the generated packages/images by
> diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> index bcba55f327..395d603cec 100644
> --- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> +++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> @@ -97,6 +97,7 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env
> perl'"
> # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it
> # which fixes build path issue in DWARF.
> SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}"
> +COMMON_OPTIMIZATION = ""
>
> do_configure_prepend () {
> rm -rf ${S}/config.h
> --
> 2.11.0
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#144958):
https://lists.openembedded.org/g/openembedded-core/message/144958
Mute This Topic: https://lists.openembedded.org/mt/78460656/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-