about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan McKay <dylanmckay34@gmail.com>2016-10-02 02:04:42 +1300
committerJake Goulding <jake.goulding@gmail.com>2016-11-18 11:24:19 -0500
commit84415ea1f2a450b0e8896696b8da4accc21b8ef5 (patch)
tree7c93a4925e81dc1bd611519408c405c8cf8866bc
parent01d061fdc04ed78ff65138e96c212ecc678a9f8f (diff)
downloadrust-84415ea1f2a450b0e8896696b8da4accc21b8ef5.tar.gz
rust-84415ea1f2a450b0e8896696b8da4accc21b8ef5.zip
[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).
-rw-r--r--src/librustc_trans/mir/block.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs
index b22bcf9825a..dd58ca5b357 100644
--- a/src/librustc_trans/mir/block.rs
+++ b/src/librustc_trans/mir/block.rs
@@ -116,6 +116,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
                 if let Some(cleanup_pad) = cleanup_pad {
                     bcx.cleanup_ret(cleanup_pad, None);
                 } else {
+                    let llpersonality = bcx.fcx().eh_personality();
+                    bcx.set_personality_fn(llpersonality);
+
                     let ps = self.get_personality_slot(&bcx);
                     let lp = bcx.load(ps);
                     bcx.with_block(|bcx| {