summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/rust-1.78-unwinding-fix.patch
diff options
context:
space:
mode:
authorEfraim Flashner <[email protected]>2024-12-02 14:13:39 +0200
committerEfraim Flashner <[email protected]>2024-12-02 14:13:39 +0200
commit541abedc0a0473d494ec22b05b6900f1d2b1c45d (patch)
tree6a86215dacf234bd1abcfcaff7b809e443e500c6 /gnu/packages/patches/rust-1.78-unwinding-fix.patch
parentb764dbc3195c843ae9f7bebb94dcaa9b1bdd43e5 (diff)
parent31e7d5d0d7e7fea677ad18496b8b9d80683891f4 (diff)
Merge remote-tracking branch 'origin/rust-team'
Change-Id: I6d5c28252f060eeb69eb02fd281e7268bb885b29
Diffstat (limited to 'gnu/packages/patches/rust-1.78-unwinding-fix.patch')
-rw-r--r--gnu/packages/patches/rust-1.78-unwinding-fix.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/gnu/packages/patches/rust-1.78-unwinding-fix.patch b/gnu/packages/patches/rust-1.78-unwinding-fix.patch
new file mode 100644
index 0000000000..8e98d6d7d9
--- /dev/null
+++ b/gnu/packages/patches/rust-1.78-unwinding-fix.patch
@@ -0,0 +1,29 @@
+From ce49a9d9e52ca6062fe0894e72d954511fa8820f Mon Sep 17 00:00:00 2001
+From: Shmuel Hazan <[email protected]>
+Date: Sat, 1 Jun 2024 08:49:44 +0300
+Subject: [PATCH] Add UWTable attr to functions with a personality function
+
+Adding a personality function forces LLVM to generate unwinding info that might be incorrect.
+To solve it, always apply the UWTable attribute when setting a personality function.
+
+Fixes #123733
+---
+ compiler/rustc_codegen_llvm/src/builder.rs | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
+index 72ff9ea118e28..668f0a33a4e80 100644
+--- a/compiler/rustc_codegen_llvm/src/builder.rs
++++ b/compiler/rustc_codegen_llvm/src/builder.rs
+@@ -1029,6 +1029,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
+ }
+
+ fn set_personality_fn(&mut self, personality: &'ll Value) {
++ // Work around for https://github.com/rust-lang/rust/issues/123733
++ // add the UWTable attribute to every function with a personality function.
++ let uwtable = attributes::uwtable_attr(self.llcx, None);
++ attributes::apply_to_llfn(self.llfn(), llvm::AttributePlace::Function, &[uwtable]);
++
+ unsafe {
+ llvm::LLVMSetPersonalityFn(self.llfn(), personality);
+ }