Auto merge of #53437 - alexcrichton:fix-target-features, r=michaelwoerister
Set more llvm function attributes for __rust_try This shim is generated elsewhere in the compiler so this commit adds support to ensure it goes through similar paths as the rest of the compiler to set llvm function attributes like target features. cc #53372
This commit is contained in:
commit
6b1ff19af3
5 changed files with 44 additions and 35 deletions
|
|
@ -503,27 +503,6 @@ pub fn codegen_instance<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, instance: Instance<'
|
|||
|
||||
cx.stats.borrow_mut().n_closures += 1;
|
||||
|
||||
// The `uwtable` attribute according to LLVM is:
|
||||
//
|
||||
// This attribute indicates that the ABI being targeted requires that an
|
||||
// unwind table entry be produced for this function even if we can show
|
||||
// that no exceptions passes by it. This is normally the case for the
|
||||
// ELF x86-64 abi, but it can be disabled for some compilation units.
|
||||
//
|
||||
// Typically when we're compiling with `-C panic=abort` (which implies this
|
||||
// `no_landing_pads` check) we don't need `uwtable` because we can't
|
||||
// generate any exceptions! On Windows, however, exceptions include other
|
||||
// events such as illegal instructions, segfaults, etc. This means that on
|
||||
// Windows we end up still needing the `uwtable` attribute even if the `-C
|
||||
// panic=abort` flag is passed.
|
||||
//
|
||||
// You can also find more info on why Windows is whitelisted here in:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
|
||||
if !cx.sess().no_landing_pads() ||
|
||||
cx.sess().target.target.options.requires_uwtable {
|
||||
attributes::emit_uwtable(lldecl, true);
|
||||
}
|
||||
|
||||
let mir = cx.tcx.instance_mir(instance.def);
|
||||
mir::codegen_mir(cx, lldecl, &mir, instance, sig);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue