Allow disabling TrapUnreachable via -Ztrap-unreachable=no

This is useful for embedded targets where small code size is desired.
For example, on my project (thumbv7em-none-eabi) this yields a 0.6% code size reduction.
This commit is contained in:
Dario Nieuwenhuis 2020-11-24 00:55:10 +01:00
parent d9a105fdd4
commit 7b62e09b03
3 changed files with 5 additions and 1 deletions

View file

@ -152,7 +152,8 @@ pub fn target_machine_factory(
let features = features.join(",");
let features = CString::new(features).unwrap();
let abi = SmallCStr::new(&sess.target.llvm_abiname);
let trap_unreachable = sess.target.trap_unreachable;
let trap_unreachable =
sess.opts.debugging_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;
let asm_comments = sess.asm_comments();