Set no-unwind attribute on all upcalls other than fail.

This commit is contained in:
Graydon Hoare 2012-04-25 15:38:56 -07:00
parent a2f04efd59
commit fa6c68a025
2 changed files with 10 additions and 1 deletions

View file

@ -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());

View file

@ -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) {