diff options
| author | bors <bors@rust-lang.org> | 2022-12-10 11:16:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-10 11:16:18 +0000 |
| commit | b12b83674f310b85f49ba799e51f9b9f1824870c (patch) | |
| tree | 30a3fba4cc6a131f33f6da5df02a6416a4ae934d /compiler/rustc_codegen_llvm/src/declare.rs | |
| parent | cbc70ff277dda8b7f227208eff789f1f68b6de5a (diff) | |
| parent | f6c2add0ed76cf2723168f76989b1704eface686 (diff) | |
| download | rust-b12b83674f310b85f49ba799e51f9b9f1824870c.tar.gz rust-b12b83674f310b85f49ba799e51f9b9f1824870c.zip | |
Auto merge of #105525 - matthiaskrgr:rollup-ricyw5s, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #98391 (Reimplement std's thread parker on top of events on SGX) - #104019 (Compute generator sizes with `-Zprint_type_sizes`) - #104512 (Set `download-ci-llvm = "if-available"` by default when `channel = dev`) - #104901 (Implement masking in FileType comparison on Unix) - #105082 (Fix Async Generator ABI) - #105109 (Add LLVM KCFI support to the Rust compiler) - #105505 (Don't warn about unused parens when they are used by yeet expr) - #105514 (Introduce `Span::is_visible`) - #105516 (Update cargo) - #105522 (Remove wrong note for short circuiting operators) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/declare.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/declare.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index dc21a02cec4..6a575095f7e 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -20,7 +20,7 @@ use crate::type_::Type; use crate::value::Value; use rustc_codegen_ssa::traits::TypeMembershipMethods; use rustc_middle::ty::Ty; -use rustc_symbol_mangling::typeid::typeid_for_fnabi; +use rustc_symbol_mangling::typeid::{kcfi_typeid_for_fnabi, typeid_for_fnabi}; use smallvec::SmallVec; /// Declare a function. @@ -136,6 +136,11 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { self.set_type_metadata(llfn, typeid); } + if self.tcx.sess.is_sanitizer_kcfi_enabled() { + let kcfi_typeid = kcfi_typeid_for_fnabi(self.tcx, fn_abi); + self.set_kcfi_type_metadata(llfn, kcfi_typeid); + } + llfn } |
