<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15102</bug_id>
          
          <creation_ts>2023-04-13 17:20:28 +0000</creation_ts>
          <short_desc>Using overrides on security flags may produce an incorrect meta-environment for the generated SDK</short_desc>
          <delta_ts>2026-10-01 15:48:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>4.1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>mark.hatle</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>95359</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2023-04-13 17:20:28 +0000</bug_when>
    <thetext>I created a baremetal distribution file, and included:

SECURITY_CFLAGS:class-target ?= &quot;&quot;
SECURITY_LDFLAGS:class-target ?= &quot;&quot;

require conf/distro/include/no-static-libs.inc
require conf/distro/include/yocto-uninative.inc
require conf/distro/include/security_flags.inc

Building my (class-target) recipes, all of the values are expected.  However when generating an SDK, the produced environment files included the security CFLAGS and LDFLAGS.

I built my SDK using &apos;bitbake meta-toolchain&apos;, this in-turn uses &apos;meta-environment&apos; recipe to construct and populate the environment files.

It appears that meta-environment does not run in class-target context, so any overrides may be evaluated differently then a normal target recipe.  This may affect both the mandatory and options cflags and ldflags, producing an incompatible environment file to the binaries in the system.

OE baremetal configuration uses &apos;tclibc-baremetal&apos; override, which likely is not present in the cross canadian contetext of meta-environemnt as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95372</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2023-04-14 15:55:06 +0000</bug_when>
    <thetext>My feeling is we may need to split meta-environment into two parts, one in target context and one in cross-canadian context since they can&apos;t access the right information of both contexts in one recipe.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95385</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-04-20 14:32:48 +0000</bug_when>
    <thetext>Mark, can you work at this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95400</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2023-04-20 16:57:23 +0000</bug_when>
    <thetext>I will continue to explore this, but at this point I&apos;m not sure how to fix it.  Splitting the environments, as RP suggests is the probably the only reasonable way to deal with this -- but I&apos;m not sure how to get the environments to split properly.

I am fine if you assign this to me, but I can&apos;t promise I&apos;ll get a fix in the short term.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95406</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-04-20 18:53:45 +0000</bug_when>
    <thetext>Thanks Mark.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>