about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/rustc/back/upcall.rs6
-rw-r--r--src/rustc/middle/trans/base.rs5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/rustc/back/upcall.rs b/src/rustc/back/upcall.rs
index f43ef4a5c12..d3946a5de14 100644
--- a/src/rustc/back/upcall.rs
+++ b/src/rustc/back/upcall.rs
@@ -38,7 +38,11 @@ fn declare_upcalls(targ_cfg: @session::config,
         let mut arg_tys: [TypeRef] = [];
         for tys.each {|t| arg_tys += [t]; }
         let fn_ty = T_fn(arg_tys, rv);
-        ret base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
+        let f = base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
+        if name != "fail" {
+            base::set_no_unwind(f);
+        }
+        ret f;
     }
     let d = bind decl(llmod, "upcall_", _, _, _);
     let dv = bind decl(llmod, "upcall_", _, _, T_void());
diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs
index bc4d9c3e673..88df4687d61 100644
--- a/src/rustc/middle/trans/base.rs
+++ b/src/rustc/middle/trans/base.rs
@@ -393,6 +393,11 @@ fn set_no_inline(f: ValueRef) {
                               0u as c_uint);
 }
 
+fn set_no_unwind(f: ValueRef) {
+    llvm::LLVMAddFunctionAttr(f, lib::llvm::NoUnwindAttribute as c_uint,
+                              0u as c_uint);
+}
+
 // Tell LLVM to emit the information necessary to unwind the stack for the
 // function f.
 fn set_uwtable(f: ValueRef) {