diff options
| author | bors <bors@rust-lang.org> | 2021-04-06 04:35:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-06 04:35:26 +0000 |
| commit | a6e7a5aa5dc842ddb64607040aefb6ec33e22b59 (patch) | |
| tree | 5e5cecc462513a6cd3798a8b5b030084dca4d0df /compiler/rustc_codegen_llvm/src | |
| parent | 0c7d4effd71f826abb9651419c316b9b57b8ac97 (diff) | |
| parent | 448d07683a6defd567996114793a09c9a8aef5df (diff) | |
| download | rust-a6e7a5aa5dc842ddb64607040aefb6ec33e22b59.tar.gz rust-a6e7a5aa5dc842ddb64607040aefb6ec33e22b59.zip | |
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`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 3 |
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 af895ccc036..e06c1c825f6 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -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. |
