diff options
| author | DianQK <dianqk@dianqk.net> | 2023-07-18 22:15:47 +0800 | 
|---|---|---|
| committer | DianQK <dianqk@dianqk.net> | 2023-07-18 22:15:47 +0800 | 
| commit | cc08749df2613c17c8c2e9d8224a24a24c126423 (patch) | |
| tree | 26f2f5b85d4c03d84204d24899e2e84dd800b5cc /compiler/rustc_codegen_llvm/src/attributes.rs | |
| parent | f0580df0d53d67ad5c7f85756eb9f221566e4fb0 (diff) | |
| download | rust-cc08749df2613c17c8c2e9d8224a24a24c126423.tar.gz rust-cc08749df2613c17c8c2e9d8224a24a24c126423.zip | |
Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level.
When `no_builtins` is applied at the crate level, we should add the `no-builtins` attribute to each function to ensure it takes effect in LTO.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 39275272e42..4c69b9503a2 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -335,6 +335,10 @@ pub fn from_fn_attrs<'ll, 'tcx>( to_add.extend(probestack_attr(cx)); to_add.extend(stackprotector_attr(cx)); + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_BUILTINS) { + to_add.push(llvm::CreateAttrString(cx.llcx, "no-builtins")); + } + if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) { to_add.push(AttributeKind::Cold.create_attr(cx.llcx)); } | 
