about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/attributes.rs
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2022-07-06 19:09:33 -0700
committerJubilee Young <workingjubilee@gmail.com>2022-07-06 22:44:58 -0700
commit530b5da49b822fd65214ecbe85455114e0ce725f (patch)
treed1bf98704b729e071d6c0d34f367f5509b87b031 /compiler/rustc_codegen_llvm/src/attributes.rs
parent92174f988b0cde631ffac0dbcc9f8fca413d566e (diff)
downloadrust-530b5da49b822fd65214ecbe85455114e0ce725f.tar.gz
rust-530b5da49b822fd65214ecbe85455114e0ce725f.zip
Also stop emitting BTI prologues for naked functions
Same idea but for AArch64.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/attributes.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs
index 8c72f7dc06f..c51c8391fa5 100644
--- a/compiler/rustc_codegen_llvm/src/attributes.rs
+++ b/compiler/rustc_codegen_llvm/src/attributes.rs
@@ -303,6 +303,8 @@ pub fn from_fn_attrs<'ll, 'tcx>(
         // And it is a module-level attribute, so the alternative is pulling naked functions into new LLVM modules.
         // Otherwise LLVM's "naked" functions come with endbr prefixes per https://github.com/rust-lang/rust/issues/98768
         to_add.push(AttributeKind::NoCfCheck.create_attr(cx.llcx));
+        // Need this for AArch64.
+        to_add.push(llvm::CreateAttrStringValue(cx.llcx, "branch-target-enforcement", "false"));
     }
     if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::ALLOCATOR) {
         // apply to return place instead of function (unlike all other attributes applied in this function)