]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Emit `uwtable` for allocator shims
authorAlex Crichton <alex@alexcrichton.com>
Fri, 27 Apr 2018 00:09:08 +0000 (17:09 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 27 Apr 2018 00:09:08 +0000 (17:09 -0700)
This commit emits the `uwtable` attribute to LLVM for platforms that require it
for the allocator shims that we generate to ensure that they can hopefully get
unwound past. This is a stab in the dark at helping
https://bugzilla.mozilla.org/show_bug.cgi?id=1456150 along.

src/librustc_trans/allocator.rs

index ffebb959ebfde494abdd58d680e008da35f76f18..871fe98ec01879612afa2b7830f558ffaa05c3a8 100644 (file)
@@ -11,6 +11,7 @@
 use std::ffi::CString;
 use std::ptr;
 
+use attributes;
 use libc::c_uint;
 use rustc::middle::allocator::AllocatorKind;
 use rustc::ty::TyCtxt;
@@ -67,6 +68,9 @@ pub(crate) unsafe fn trans(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind)
         if tcx.sess.target.target.options.default_hidden_visibility {
             llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
         }
+       if tcx.sess.target.target.options.requires_uwtable {
+           attributes::emit_uwtable(llfn, true);
+       }
 
         let callee = CString::new(kind.fn_name(method.name)).unwrap();
         let callee = llvm::LLVMRustGetOrInsertFunction(llmod,