Closed
Description
I've been recently writing a kernel for the RISC-V architecture, using strictly as much Rust as I can get away with and during which I've run into the need to have certain functions aligned to specific byte alignments (ex. any function placed in mtvec
MUST be 4 byte aligned), and while I can seemingly accomplish this using asm!(".align <alignment>")
I think it would make sense for that to be an attribute of the function itself, whether it be limited to extern "C"
fns or valid on all ABIs. Example of what I am asking for:
#[no_mangle]
#[repr(align(4))]
extern "C" fn gets_put_in_mtvec() {
// ... content here ...
}