diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2019-10-29 12:01:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-29 12:01:38 -0700 |
| commit | 8aa23125bb40f6949fcd2c4f48151c4d8a444419 (patch) | |
| tree | 9078d6ef80abe9bd3f999b901bb8da7d0d8fc620 /src/librustc_codegen_llvm | |
| parent | c4960c26027b6556aa5a63bc4a2c5697cf904e75 (diff) | |
| parent | 92c049be583a559430f17f3364c616fc92c059a1 (diff) | |
Rollup merge of #65832 - tlively:emscripten-exception-handling, r=alexcrichton
Re-enable Emscripten's exception handling support Passes LLVM codegen and Emscripten link-time flags for exception handling if and only if the panic strategy is `unwind`. Sets the default panic strategy for Emscripten targets to `unwind`. Re-enables tests that depend on unwinding support for Emscripten, including `should_panic` tests. r? @alexcrichton
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/llvm_util.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 2dce9b04c9e..85e0b6d465a 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -3,7 +3,7 @@ use crate::llvm; use syntax_pos::symbol::Symbol; use rustc::session::Session; use rustc::session::config::PrintRequest; -use rustc_target::spec::MergeFunctions; +use rustc_target::spec::{MergeFunctions, PanicStrategy}; use libc::c_int; use std::ffi::CString; use syntax::feature_gate::UnstableFeatures; @@ -73,6 +73,11 @@ unsafe fn configure_llvm(sess: &Session) { } } + if sess.target.target.target_os == "emscripten" && + sess.panic_strategy() == PanicStrategy::Unwind { + add("-enable-emscripten-cxx-exceptions"); + } + // HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes // during inlining. Unfortunately these may block other optimizations. add("-preserve-alignment-assumptions-during-inlining=false"); |
