diff options
| author | Vadim Chugunov <vadimcn@gmail.com> | 2015-08-01 16:07:38 -0700 |
|---|---|---|
| committer | Vadim Chugunov <vadimcn@gmail.com> | 2015-08-01 22:00:46 -0700 |
| commit | e493027984b5961617c867a7003face00a057c92 (patch) | |
| tree | a8c9cda54b4311b0f74432aaab293a98afc6c428 /src | |
| parent | 6112b220782134c70516301f7dab2e05e3283f54 (diff) | |
| download | rust-e493027984b5961617c867a7003face00a057c92.tar.gz rust-e493027984b5961617c867a7003face00a057c92.zip | |
When a `nounwind` function has a personality routine, LLVM messes up .seh directives (happens to `rust_try` in optimized builds). A workaround is to give `rust_try` the `uwtable` attribute.
Also, make sure that the dummy "load from null" instruction inserted by init_function() gets cleaned up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_trans/trans/intrinsic.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index e0062493e0a..0400771dff1 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -16,6 +16,7 @@ use llvm::{SequentiallyConsistent, Acquire, Release, AtomicXchg, ValueRef, TypeK 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 }); |
