Bug 16132

Summary: rust-native: sstate is not reused between risc-v and any other target
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Alexander Kanavin <alex.kanavin>
Component: devtools / tool chainAssignee: Unassigned <unassigned>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: meta.mr.watcher, meta.watcher, richard.purdie
Version: unspecified   
Target Milestone: 0.0.0   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alexander Kanavin 2026-01-14 10:16:01 UTC
I've noticed that rust-native is being rebuilt when MACHINE is set to qemurisv64, even though a suitable rust-native is in sstate (and is used for other targets).

Via task signatures this has been traced to the following code in meta/classes-recipe/rust-target-config.bbclass

    if "riscv64" in tspec['llvm-target']:
        tspec['llvm-abiname'] = d.getVar('TUNE_RISCV_ABI')
    if "riscv32" in tspec['llvm-target']:
        tspec['llvm-abiname'] = d.getVar('TUNE_RISCV_ABI')


Unfortunately this adds a dependency on TUNE_RISCV_ABI (which is set only if the target is a risc-v machine) to rust-native's rust_gen_targets task, breaking sstate reuse for it between risc-v and any other target. I can imagine other native pieces written in rust will have the same issue.

It's not immediately obvious to me how to address this, so I'd really appreciate suggestions. The code is hairy (i.e. tricky and brittle).
Comment 1 Alexander Kanavin 2026-01-14 13:46:37 UTC
Patches: https://patchwork.yoctoproject.org/project/oe-core/list/?series=42264