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:
commit
a6e7a5aa5d
18 changed files with 137 additions and 83 deletions
|
@ -280,6 +280,9 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
|
|||
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::CMSE_NONSECURE_ENTRY) {
|
||||
llvm::AddFunctionAttrString(llfn, Function, cstr!("cmse_nonsecure_entry"));
|
||||
}
|
||||
if let Some(align) = codegen_fn_attrs.alignment {
|
||||
llvm::set_alignment(llfn, align as usize);
|
||||
}
|
||||
sanitize(cx, codegen_fn_attrs.no_sanitize, llfn);
|
||||
|
||||
// Always annotate functions with the target-cpu they are compiled for.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue