diff options
| author | Nikita Popov <npopov@redhat.com> | 2024-02-19 15:02:49 +0100 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2024-04-25 11:43:47 +0900 |
| commit | 3695af697efa26b0ea3b67739ade3ecc3929154e (patch) | |
| tree | 0b34ec36942c528246b5f3a85014f6952d8d99c3 /compiler/rustc_llvm/llvm-wrapper | |
| parent | aa067fb984d36462548bb785da221bfaf38253f0 (diff) | |
| download | rust-3695af697efa26b0ea3b67739ade3ecc3929154e.tar.gz rust-3695af697efa26b0ea3b67739ade3ecc3929154e.zip | |
Set writable and dead_on_unwind attributes for sret arguments
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h | 2 | ||||
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h b/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h index 6d578c97f3f..a493abbbc7e 100644 --- a/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h +++ b/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h @@ -91,6 +91,8 @@ enum LLVMRustAttribute { AllocAlign = 39, SanitizeSafeStack = 40, FnRetThunkExtern = 41, + Writable = 42, + DeadOnUnwind = 43, }; typedef struct OpaqueRustString *RustStringRef; diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 37c2da4c23a..fb5a56155fd 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -312,6 +312,16 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) { return Attribute::SafeStack; case FnRetThunkExtern: return Attribute::FnRetThunkExtern; +#if LLVM_VERSION_GE(18, 0) + case Writable: + return Attribute::Writable; + case DeadOnUnwind: + return Attribute::DeadOnUnwind; +#else + case Writable: + case DeadOnUnwind: + report_fatal_error("Not supported on this LLVM version"); +#endif } report_fatal_error("bad AttributeKind"); } |
