Skip to content

Commit ce49a9d

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 #123733
1 parent cfb7304 commit ce49a9d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_codegen_llvm/src/builder.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,11 @@ 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 = attributes::uwtable_attr(self.llcx, None);
1035+
attributes::apply_to_llfn(self.llfn(), llvm::AttributePlace::Function, &[uwtable]);
1036+
10321037
unsafe {
10331038
llvm::LLVMSetPersonalityFn(self.llfn(), personality);
10341039
}

0 commit comments

Comments
 (0)