about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorWesley Norris <repnop@outlook.com>2021-01-20 21:49:04 -0500
committerWesley Norris <repnop@outlook.com>2021-04-05 17:36:51 -0400
commit448d07683a6defd567996114793a09c9a8aef5df (patch)
tree31166353d2a3494c2e009ab8f692b5a8bb99d982 /compiler/rustc_codegen_llvm/src
parent138fd56cf9598b4bf016634c768dca128a83a5d7 (diff)
downloadrust-448d07683a6defd567996114793a09c9a8aef5df.tar.gz
rust-448d07683a6defd567996114793a09c9a8aef5df.zip
Allow specifying alignment for functions
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/attributes.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
index 64ebe585dd8..e50a9d16ca4 100644
--- a/compiler/rustc_codegen_llvm/src/attributes.rs
+++ b/compiler/rustc_codegen_llvm/src/attributes.rs
@@ -279,6 +279,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.