Skip to content

Commit 84415ea

Browse files
Dylan McKayshepmaster
Dylan McKay
authored andcommitted
[LLVM 4.0] Set EH personality when resuming stack unwinding
To resume stack unwinding, the LLVM `resume` instruction must be used. In order to use this instruction, the calling function must have an exception handling personality set. LLVM 4.0 adds a new IR validation check to ensure a personality is always set in these cases. This was introduced in [r277360](https://reviews.llvm.org/rL277360).
1 parent 01d061f commit 84415ea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_trans/mir/block.rs

+3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
116116
if let Some(cleanup_pad) = cleanup_pad {
117117
bcx.cleanup_ret(cleanup_pad, None);
118118
} else {
119+
let llpersonality = bcx.fcx().eh_personality();
120+
bcx.set_personality_fn(llpersonality);
121+
119122
let ps = self.get_personality_slot(&bcx);
120123
let lp = bcx.load(ps);
121124
bcx.with_block(|bcx| {

0 commit comments

Comments
 (0)