-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
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 ...
}
Skallwar, BlackHoleFox, memoryruins, leonardo-m, yvt and 2 more
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team