This code:
#![no_std]
#![feature(asm)]
#![feature(start)]
#![feature(lang_items)]
#[lang = "eh_personality"] extern fn eh_personality() {}
#[panic_handler] fn panic(info: &::core::panic::PanicInfo) -> ! { loop {} }
#[start] fn start(_argc: isize, _argv: *const *const u8) -> isize {0}
#[no_mangle] pub fn abort() -> ! { loop {} }
#[no_mangle]
pub fn _start(a: [u32; 6]) {
unsafe {
asm!(""
:: "r{sp}"(a[4]), "r{t0}"(a[5])
: "volatile"
);
}
}
When compiled for the riscv64imac target:
$ cargo rustc --release --target riscv64imac-unknown-none-elf
Ignores the input register constraints which say to use sp and t0 (defaulting to a0 and a1 instead):
0000000000011000 <_start>:
11000: 01456583 lwu a1,20(a0)
11004: 01056503 lwu a0,16(a0)
11008: 8082 ret
This code:
When compiled for the riscv64imac target:
Ignores the input register constraints which say to use
spandt0(defaulting to a0 and a1 instead):