<?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>16424</bug_id>
          
          <creation_ts>2026-09-11 14:02:39 +0000</creation_ts>
          <short_desc>compiler-rt fails to build for pre-Thumb-2 32-bit ARM targets (armv4/armv5/bare armv6)</short_desc>
          <delta_ts>2026-09-24 15:05:53 +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>6.0.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</op_sys>
          <bug_status>ACCEPTED</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="Jan Strater-Büddefeld">jst</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sundeep.kokkonda</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>106820</commentid>
    <comment_count>0</comment_count>
    <who name="Jan Strater-Büddefeld">jst</who>
    <bug_when>2026-09-11 14:02:39 +0000</bug_when>
    <thetext>Building `compiler-rt` (LLVM/clang 22.1.3) for a 32-bit ARM target without Thumb-2 (e.g. TUNE=arm926ejs, ARMv5TE, no Thumb-2) fails with:

  arm/divsf3.S:206:3: error: invalid instruction, any one of the following would fix this:
    mls r1, r0, r3, r1
  note: instruction requires: armv6t2
  note: instruction requires: thumb2

Root cause:
compiler-rt_git.bb passes -DCMAKE_C_COMPILER_TARGET=${HOST_SYS}, which for every 32-bit ARM tune resolves to the same generic triple &quot;arm-oe-linux-musleabi&quot;.

As a result, lib/builtins/CMakeLists.txt selects BUILTIN_SUPPORTED_ARCH=&quot;arm&quot;-&gt;arm_SOURCES instead of the correct armv5te_SOURCES/armv6_SOURCES.

Steps to reproduce:
1. MACHINE using an ARM tune without Thumb-2, e.g. arm926ejs
   (conf/machine/include/arm/armv5/tune-arm926ejs.inc)
2. TOOLCHAIN = &quot;clang&quot; so clang is used as the target compiler
3. bitbake compiler-rt


Workaround compiler-rt_git.bbappend:
  EXTRA_OECMAKE:append:armv4 = &quot; -DCOMPILER_RT_ARM_OPTIMIZED_FP=OFF&quot;
  EXTRA_OECMAKE:append:armv5 = &quot; -DCOMPILER_RT_ARM_OPTIMIZED_FP=OFF&quot;
  EXTRA_OECMAKE:append:armv6 = &quot; -DCOMPILER_RT_ARM_OPTIMIZED_FP=OFF&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106874</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-09-17 16:13:10 +0000</bug_when>
    <thetext>This looks a lot like an upstream clang problem, would you be able to replicate it outside of yocto?

Until it&apos;s root-caused, your workaround is fine. Would you be able to send a patch to add that to the compiler-rt recipe?

Marking as NEEDINFO status, if you are able to send a patch please do so and switch the bug to ACCEPTED. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106875</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-09-17 16:26:27 +0000</bug_when>
    <thetext>Ah, is this related to this function:

def get_compiler_rt_arch(bb, d):
    if bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;armv5 thumb dsp&apos;, True, False, d):
        return &apos;armv5te&apos;
    elif bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;armv4 thumb&apos;, True, False, d):
        return &apos;armv4t&apos;
    elif bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;arm vfp callconvention-hard&apos;, True, False, d):
        return &apos;armhf&apos;
    return d.getVar(&apos;HOST_ARCH&apos;)

If no thumb it will fallback to HOST_ARCH, when it should be passing different values?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106893</commentid>
    <comment_count>3</comment_count>
    <who name="Jan Strater-Büddefeld">jst</who>
    <bug_when>2026-09-18 21:58:00 +0000</bug_when>
    <thetext>(In reply to Ross Burton from comment #2)
&gt; Ah, is this related to this function:
&gt; 
&gt; def get_compiler_rt_arch(bb, d):
&gt;     if bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;armv5 thumb dsp&apos;, True, False, d):
&gt;         return &apos;armv5te&apos;
&gt;     elif bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;armv4 thumb&apos;, True, False, d):
&gt;         return &apos;armv4t&apos;
&gt;     elif bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;arm vfp callconvention-hard&apos;,
&gt; True, False, d):
&gt;         return &apos;armhf&apos;
&gt;     return d.getVar(&apos;HOST_ARCH&apos;)
&gt; 
&gt; If no thumb it will fallback to HOST_ARCH, when it should be passing
&gt; different values?

Yeah, that&apos;s also wrong but CMake isn&apos;t using the value passed via `COMPILER_RT_DEFAULT_TARGET_ARCH` as far as I can see. Setting the correct arch type in ` CMAKE_C_COMPILER_TARGET` fixes the problem in my test (even if `COMPILER_RT_DEFAULT_TARGET_ARCH` is not set at all). I think that is a better approach than my previous workaround. I could provide a patch for that hopefully next week.


(In reply to Ross Burton from comment #1)
&gt; This looks a lot like an upstream clang problem, would you be able to
&gt; replicate it outside of yocto?
&gt; 
&gt; Until it&apos;s root-caused, your workaround is fine. Would you be able to send a
&gt; patch to add that to the compiler-rt recipe?
&gt; 
&gt; Marking as NEEDINFO status, if you are able to send a patch please do so and
&gt; switch the bug to ACCEPTED. Thanks!

Honestly, the CMake files of compiler-rt are so complicated that I can&apos;t say if that&apos;s a bug from Yocto or them... You can see in the Yocto CMake configure logs that compiler-rt is build for the wrong target (arm), so this should be replicateable outside of Yocto but my clang does support all backends and therefore doesn&apos;t fail.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>