Closed
Description
Example
// Compile with rustc --target riscv32imc-unknown-none-elf -C target-feature=+unaligned-scalar-mem --emit=obj
#![no_std]
#![no_main]
use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
Current output
warning: unknown feature specified for `-Ctarget-feature`: `unaligned-scalar-mem`
|
= note: it is still passed through to the codegen backend
= help: consider filing a feature request
warning: 1 warning emitted
Desired output
No warning
Background / Rationale
Some RISC-V cores support unaligned access to memory without trapping. On such cores, the compiler could significantly improve code-size and performance when using functions like core::ptr::read_unaligned by emitting a single load or store instruction with an unaligned address, rather than a long sequence of byte-sized load/store/bitmanip instructions.
I need to use the unaligned-scalar-mem
target feature to improve code-size and performance. When I set the flag -C target-feature=+unaligned-scalar-mem
, LLVM successfully recognizes the target feature and generates the desired machine code, but rustc prints out the warning above, and I can't figure out how to disable it.