Skip to content

Commit

Permalink
Rollup merge of rust-lang#50263 - alexcrichton:uwtable-allcoators, r=…
Browse files Browse the repository at this point in the history
…eddyb

rustc: Emit `uwtable` for allocator shims

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.
  • Loading branch information
kennytm authored Apr 27, 2018
2 parents 1c1fd27 + 20ad427 commit 0da4bde
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc_trans/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0da4bde

Please sign in to comment.