guix/gnu/packages/patches/rust-1.78-unwinding-fix.patch
Brennan Vincent d3f5963b7c
gnu: rust: Update to 1.78.
* gnu/packages/rust.scm (rust): Update to 1.78.
[source]: Adjust removal of bundled source libraries.
[arguments]: Add a phase skipping tests requiring crates.io.
(rust-1.78)[source]: Add patch.
* gnu/packages/patches/rust-1.78-unwinding-fix.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I7bf37a9321447ac21644af0e2d023b8bc556da59
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2024-11-28 11:04:08 +02:00

29 lines
1.3 KiB
Diff

From ce49a9d9e52ca6062fe0894e72d954511fa8820f Mon Sep 17 00:00:00 2001
From: Shmuel Hazan <ShmuelHazan0@gmail.com>
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);
}