]> git.lizzy.rs Git - rust.git/commitdiff
When a `nounwind` function has a personality routine, LLVM messes up .seh directives...
authorVadim Chugunov <vadimcn@gmail.com>
Sat, 1 Aug 2015 23:07:38 +0000 (16:07 -0700)
committerVadim Chugunov <vadimcn@gmail.com>
Sun, 2 Aug 2015 05:00:46 +0000 (22:00 -0700)
Also, make sure that the dummy "load from null" instruction inserted by init_function() gets cleaned up.

src/librustc_trans/trans/intrinsic.rs

index e0062493e0a5f92cf9a4272699fac98697d0f62c..0400771dff15c0cebe0f1b967447b2af19b95d34 100644 (file)
@@ -16,6 +16,7 @@
 use middle::subst;
 use middle::subst::FnSpace;
 use trans::adt;
+use trans::attributes;
 use trans::base::*;
 use trans::build::*;
 use trans::callee;
@@ -1189,6 +1190,7 @@ fn trans_gnu_try<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         //      ret ptr
 
         let rust_try = declare::define_internal_rust_fn(ccx, "__rust_try", try_fn_ty);
+        attributes::emit_uwtable(rust_try, true);
         let catch_pers = match bcx.tcx().lang_items.eh_personality_catch() {
             Some(did) => callee::trans_fn_ref(ccx, did, ExprId(0),
                                               bcx.fcx.param_substs).val,
@@ -1219,6 +1221,7 @@ fn trans_gnu_try<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
         AddClause(catch, vals, C_null(Type::i8p(ccx)));
         let ptr = ExtractValue(catch, vals, 0);
         Ret(catch, ptr, dloc);
+        fcx.cleanup();
 
         return rust_try
     });