Skip to content

Commit 0d1a42a

Browse files
committed
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 rust-lang#123733
1 parent cfb7304 commit 0d1a42a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/rustc_codegen_llvm/src/builder.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,12 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
10291029
}
10301030

10311031
fn set_personality_fn(&mut self, personality: &'ll Value) {
1032+
// Work around for https://github.com/rust-lang/rust/issues/123733
1033+
// add the UWTable attribute to every function with a personality function.
1034+
let uwtable =
1035+
attributes::uwtable_attr(self.llcx, None);
1036+
attributes::apply_to_llfn(self.llfn(), llvm::AttributePlace::Function, &[uwtable]);
1037+
10321038
unsafe {
10331039
llvm::LLVMSetPersonalityFn(self.llfn(), personality);
10341040
}

0 commit comments

Comments
 (0)