Absolutely.
I would add an example of issue I've seen in a software project.
Someone developing a new application and using the image-based SDK that I provided got the right functional behaviour on target.
Once this application was integrated into the core image of our Yocto project (new recipe), the same tests on target failed (application crash).
The root cause was : the two binaries produced were different because the effective GCC options at compile time were different between both methods (security flags not enabled when compiling with the SDK).
Antoine

Le mar. 24 mars 2020 à 19:34, Tom Hochstein <tom.hochstein@nxp.com> a écrit :


> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: Tuesday, March 24, 2020 1:03 PM
> To: Antoine Manache <a.manache@gmail.com>; Tom Hochstein <tom.hochstein@nxp.com>
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core][PATCH] security_flags.inc: fix flags missing from SDK toolchain
>
> On Tue, 2020-03-24 at 18:25 +0100, Antoine Manache wrote:
> > I've already sent this patch few months ago but not taken into
> > account yet.
>
> Can someone explain more about the issue here please?
>
> Shouldn't these flags be added to the SDK toolchain environment files
> rather than coded into the compiler? Why aren't they being coded in? or
> is gcc being misconfigured?

The recipe meta-environment inherits cross-canadian and toolchain-scripts. The latter generates the SDK toolchain environment file using TARGET_CC_ARCH and TARGET_LDFLAGS like this:

        echo 'export CC="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
        echo 'export LDFLAGS="${TARGET_LDFLAGS}"' >> $script

https://github.com/openembedded/openembedded-core/blob/master/meta/classes/toolchain-scripts.bbclass#L82

With class-cross-canadian as the applicable override, updating the security flags for class-target does nothing for the SDK toolchain, hence the proposed fix:

TARGET_CC_ARCH_append_class-target = " ${SECURITY_CFLAGS}"
+TARGET_CC_ARCH_append_class-cross-canadian = " ${SECURITY_CFLAGS}"
 TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}"
+TARGET_LDFLAGS_append_class-cross-canadian = " ${SECURITY_LDFLAGS}"

Tom