I have issues with setting optimization flags in meson-built project.

1. In do_write_config task, meson.cross is generated with `c = ${CC}` and 
`c_args = ${CFLAGS}`.
2. In do_configure, meson setup is called with recipe-defined buildtype and 
generated meson.cross file.
3. In do_compile, compile commands are composed roughly as `$c <meson_flags> 
$c_args`, i.e. `${CC} <meson_flags> ${CFLAGS}`. Recipe-defined buildtype 
propagates as optimization flags into <meson_flags> (based on 
https://mesonbuild.com/Builtin-options.html#details-for-buildtype mapping).

CFLAGS is composed of TARGET_CFLAGS, which is in turn composed of 
SELECTED_OPTIMIZATION, which equals either DEBUG_OPTIMIZATION ("-Og 
${DEBUG_FLAGS} -pipe") or FULL_OPTIMIZATION ("-O2 -pipe ${DEBUG_FLAGS}"), based 
on value of DEBUG_BUILD. In any case, CFLAGS features optimization flags 
including -Ox.

As a result, the -Oy flag in <meson_flags> does not have any effect because it 
is always overriden by ${CFLAGS}.

Is it intentional that meson buildtype has in fact no effect? Or am I missing 
something?

/Petr
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#202675): 
https://lists.openembedded.org/g/openembedded-core/message/202675
Mute This Topic: https://lists.openembedded.org/mt/107626791/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to