Re: [PATCH] cmake: read asm flags correctly from environment in toolchain file


Peter Kjellerstedt
 

-----Original Message-----
From: openembedded-core@... <openembedded-
core@...> On Behalf Of Martin Beeger
Sent: den 14 februari 2022 17:32
To: Richard Purdie <richard.purdie@...>; openembedded-
core@...
Subject: Re: [OE-core] [PATCH] cmake: read asm flags correctly from
environment in toolchain file


I'm a little more puzzled on this one since whilst we set CFLAGS and
CXXFLAGS in
bitbake.conf, we don't set ASMFLAGS and it wouldn't be present in our
environment.

Perhaps this should be $ENV{CFLAGS} instead of ${CMAKE_C_FLAGS}? There
are flags
in our CFLAGS which like need to be passed to the assembler too?
I am a bit unsure now about this.
As far as I understand the environment-setup will not set ASMFLAGS, that
is correct. For all non-cmake recipes, the compiler will not pick up
CFLAGS instead. It will simply still use no extra parameters for the
inline assembly.
In cmake it will use the CFLAGS for the ASM too, yielding inconsistent
behaviour over build systems. Is that really a good thing?

Also the CFLAGS are usually "-O2 -g". At least the -g parameter will
have limited effect for the assembly, and optimizations for inline
assembly are also extremely limited.
So the practical difference between both modes and whether the flags
propagate through is minimal, if at all existent.

All critical compiler parameters like the --sysroot and others are not
stored in CFLAGS, but are instead directly appended to the compiler
executable path for CC, CXX and so on. These are always applied and
cmake does understand these, parses them out, forces them to always be
there etc.
This code has nothing to do with that, it only impacts the optimization
and debugging flags.

This patch makes this behaviour consistent between cmake and non-cmake
recipes in that is never applies ASM flags, instead of inconsistently
applying them.
For the record, the variable name that, e.g., make expects for assembler
flags in its default rules is "ASFLAGS", not "ASMFLAGS".

//Peter

Join openembedded-core@lists.openembedded.org to automatically receive all group messages.