]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_codegen_llvm/src/context.rs
Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisa
[rust.git] / compiler / rustc_codegen_llvm / src / context.rs
index f6fcdc90cb61f3217845a0a4e6f69119197ddce9..f3bff5d57161e25422ab811186ab2a1367cecefa 100644 (file)
@@ -249,6 +249,11 @@ pub unsafe fn create_module<'ll>(
         );
     }
 
+    if sess.is_sanitizer_kcfi_enabled() {
+        let kcfi = "kcfi\0".as_ptr().cast();
+        llvm::LLVMRustAddModuleFlag(llmod, llvm::LLVMModFlagBehavior::Override, kcfi, 1);
+    }
+
     // Control Flow Guard is currently only supported by the MSVC linker on Windows.
     if sess.target.is_like_msvc {
         match sess.opts.cg.control_flow_guard {