<?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>15897</bug_id>
          
          <creation_ts>2025-06-09 16:09:21 +0000</creation_ts>
          <short_desc>OpenSBI: Recipe fails to build if zicsr and/or zifencei are in the path (RISC-V)</short_desc>
          <delta_ts>2026-09-22 13:42:13 +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>core</component>
          <version>5.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.1 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Trevor Gamblin">tgamblin</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>tgamblin</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102218</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2025-06-09 16:09:21 +0000</bug_when>
    <thetext>The recipe ignores the passed in -march= and other parameters, instead it discovers it&apos;s own settings for the compiler.  (I believe this is because, like u-boot and the kenrel, OpenSBI is really building baremetal software.)

In the configuration/compile step, in the Makefile there is a specific check to see if the _zicsr and _zifencei are supported by the compiler in -march=.

CC_SUPPORT_ZICSR_ZIFENCEI := $(shell $(CC) $(CLANG_TARGET) $(RELAX_FLAG) -nostdlib -march=rv$(OPENSBI_CC_XLEN)imafd_zicsr_zifencei -x c /dev/null -o /dev/null 2&gt;&amp;1 | grep -e &quot;zicsr&quot; -e &quot;zifencei&quot; &gt; /dev/null &amp;&amp; echo n || echo y)

The compilation command in the check always fails, the difference is if it fails saying that it can&apos;t link or that there is an error with the cflags (march=) passed to the compiler.   The grep statement is too broad, in that it will scan the entire error message including any paths, if the paths have zicsr and/or zifencei then the condition is triggered and the system doesn&apos;t believe it needs to specify those options in -march=.

Later during compilation, when the instructions are used a failure will occur as they are not in the &apos;imafd&apos; configuation in the current gcc.

I suspect the Yocto Project fix is to either hard code the value to &apos;y&apos; (unconditionally), or work with the upstream project to make the test better and somehow ignore the current path.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102246</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2025-06-12 14:35:46 +0000</bug_when>
    <thetext>Need to identify someone to help with RISC-V issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104634</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-03-13 14:43:43 +0000</bug_when>
    <thetext>Medium+ bugs should have a 6.1-M* milestone so pick M2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106770</commentid>
    <comment_count>3</comment_count>
    <who name="Trevor Gamblin">tgamblin</who>
    <bug_when>2026-09-09 18:45:48 +0000</bug_when>
    <thetext>Pretty sure this just needs a little rework to the relevant Makefile lines (a couple of other spots have the same pattern). I should have a patch soon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106796</commentid>
    <comment_count>4</comment_count>
    <who name="Trevor Gamblin">tgamblin</who>
    <bug_when>2026-09-10 15:41:12 +0000</bug_when>
    <thetext>Patches on the mailing list: https://lore.kernel.org/openembedded-core/20260910150843.1531415-1-tgamblin@baylibre.com/T/#t

One needed to patch OpenSBI itself, the other to remove the TUNE_RISCV_PKGARCH restriction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106907</commentid>
    <comment_count>5</comment_count>
    <who name="Trevor Gamblin">tgamblin</who>
    <bug_when>2026-09-22 13:42:13 +0000</bug_when>
    <thetext>Fixed in: https://git.openembedded.org/openembedded-core/commit/?id=beff656c54be6d80880b5208944b8405debcff60</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>