Skip to content

Commit fa6c68a

Browse files
committed
Set no-unwind attribute on all upcalls other than fail.
1 parent a2f04ef commit fa6c68a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/rustc/back/upcall.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ fn declare_upcalls(targ_cfg: @session::config,
3838
let mut arg_tys: [TypeRef] = [];
3939
for tys.each {|t| arg_tys += [t]; }
4040
let fn_ty = T_fn(arg_tys, rv);
41-
ret base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
41+
let f = base::decl_cdecl_fn(llmod, prefix + name, fn_ty);
42+
if name != "fail" {
43+
base::set_no_unwind(f);
44+
}
45+
ret f;
4246
}
4347
let d = bind decl(llmod, "upcall_", _, _, _);
4448
let dv = bind decl(llmod, "upcall_", _, _, T_void());

src/rustc/middle/trans/base.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ fn set_no_inline(f: ValueRef) {
393393
0u as c_uint);
394394
}
395395

396+
fn set_no_unwind(f: ValueRef) {
397+
llvm::LLVMAddFunctionAttr(f, lib::llvm::NoUnwindAttribute as c_uint,
398+
0u as c_uint);
399+
}
400+
396401
// Tell LLVM to emit the information necessary to unwind the stack for the
397402
// function f.
398403
fn set_uwtable(f: ValueRef) {

0 commit comments

Comments
 (0)