Closed as not planned
Closed as not planned
Description
I tried this code with cargo b --target riscv64gc-unknown-none-elf
#![no_std]
#![feature(naked_functions)]
core::arch::global_asm!(
r"
.macro LDR rd, rs, off
ld \rd, \off*8(\rs)
.endm
",
);
#[naked]
/// # Safety
pub unsafe extern "C" fn context_switch() {
unsafe {
core::arch::naked_asm!(
"
// omit code around
LDR s11, a1, 13
ret",
)
}
}
I expected to see this happen: the code compiles.
Instead, this happened: macro in global_asm! is not recognized in naked_asm!.
error: unrecognized instruction mnemonic, did you mean: fld, ld?
|
note: instantiated into assembly here
--> <inline asm>:8:9
|
8 | LDR s11, a1, 13
| ^
Actually the code does compile until nightly-2024-12-12. I use cargo-bisect-rustc to find out the regressed commit is 1daec06 , which points to #128004 .
Is this a desired behavior change? How could the code compile on latest nightly rustc?
BTW the code above compiles with cargo check --target riscv64gc-unknown-none-elf
, why is that?
Meta
rustc --version --verbose
:
rustc 1.85.0-nightly (7f75bfa1a 2024-12-30)
binary: rustc
commit-hash: 7f75bfa1ad4e9a9d33a179a90603001515e91991
commit-date: 2024-12-30
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6