1
Fork 0

Auto merge of #81234 - repnop:fn-alignment, r=lcnr

Allow specifying alignment for functions

Fixes #75072

This allows the user to specify alignment for functions, which can be useful for low level work where functions need to necessarily be aligned to a specific value.

I believe the error cases not covered in the match are caught earlier based on my testing so I had them just return `None`.
This commit is contained in:
bors 2021-04-06 04:35:26 +00:00
commit a6e7a5aa5d
18 changed files with 137 additions and 83 deletions

View file

@ -38,6 +38,9 @@ pub struct CodegenFnAttrs {
/// be generated against a specific instruction set. Only usable on architectures which allow
/// switching between multiple instruction sets.
pub instruction_set: Option<InstructionSetAttr>,
/// The `#[repr(align(...))]` attribute. Indicates the value of which the function should be
/// aligned to.
pub alignment: Option<u32>,
}
bitflags! {
@ -103,6 +106,7 @@ impl CodegenFnAttrs {
link_section: None,
no_sanitize: SanitizerSet::empty(),
instruction_set: None,
alignment: None,
}
}