about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoa <coolreader18@gmail.com>2024-02-22 16:52:48 -0600
committerNoa <coolreader18@gmail.com>2024-02-22 16:52:48 -0600
commit658a0a20eac4341e31c57cf08e019b53f09b93b4 (patch)
tree418e476370232497272af15ac0e3575fbd6d1e5e
parent861c7e74c8bbc49082dcd38ef7169d99c69cd104 (diff)
downloadrust-658a0a20eac4341e31c57cf08e019b53f09b93b4.tar.gz
rust-658a0a20eac4341e31c57cf08e019b53f09b93b4.zip
Unconditionally pass -wasm-enable-eh
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs12
-rw-r--r--library/panic_unwind/src/lib.rs7
2 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index e383673e1d4..51e1f408a69 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -99,12 +99,12 @@ unsafe fn configure_llvm(sess: &Session) {
             }
         }
 
-        if sess.panic_strategy() == PanicStrategy::Unwind {
-            if sess.target.os == "emscripten" {
-                add("-enable-emscripten-cxx-exceptions", false);
-            } else if wants_wasm_eh(sess) {
-                add("-wasm-enable-eh", false);
-            }
+        if wants_wasm_eh(sess) {
+            add("-wasm-enable-eh", false);
+        }
+
+        if sess.target.os == "emscripten" && sess.panic_strategy() == PanicStrategy::Unwind {
+            add("-enable-emscripten-cxx-exceptions", false);
         }
 
         // HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes
diff --git a/library/panic_unwind/src/lib.rs b/library/panic_unwind/src/lib.rs
index bc3c9363d8a..37e1d2cf6d1 100644
--- a/library/panic_unwind/src/lib.rs
+++ b/library/panic_unwind/src/lib.rs
@@ -60,12 +60,7 @@ cfg_if::cfg_if! {
     ))] {
         #[path = "gcc.rs"]
         mod real_imp;
-    } else if #[cfg(all(target_family = "wasm", panic = "unwind"))] {
-        // for now, PanicStrategy::Unwind is not the default for wasm targets,
-        // so we need the panic = "unwind" in the cfg above. to use llvm.wasm.throw,
-        // we need to pass -wasm-enable-eh to LLVM, but that only happens if rustc
-        // is compiling with -C panic=unwind. So, this lets us -Zbuild-std with
-        // panic=unwind, while keeping the default panic=abort working.
+    } else if #[cfg(target_family = "wasm")] {
         #[path = "wasm.rs"]
         mod real_imp;
     } else {