aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-20 09:43:30 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-20 09:43:30 -0800
commit8f802774d850b5e5c1a48419d0a655471d29018e (patch)
tree1ae056550c9c92e57eb2718e4d68a161a45baccb
parent10af3696c0c6cd6e4050d6b4534dfc05c5e0d52f (diff)
allow only setjmp or c++ exceptions in fastcomp for now
-rw-r--r--lib/Transforms/NaCl/LowerEmExceptionsPass.cpp9
-rw-r--r--lib/Transforms/NaCl/PNaClABISimplify.cpp4
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp b/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
index 1cb246563b..1669603de7 100644
--- a/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
+++ b/lib/Transforms/NaCl/LowerEmExceptionsPass.cpp
@@ -84,6 +84,15 @@ INITIALIZE_PASS(LowerEmExceptions, "loweremexceptions",
bool LowerEmExceptions::runOnModule(Module &M) {
TheModule = &M;
+ // Checks
+
+ Function *Setjmp = TheModule->getFunction("setjmp");
+ if (Setjmp) {
+ for (Instruction::use_iterator UI = Setjmp->use_begin(), UE = Setjmp->use_end(); UI != UE; ++UI) {
+ assert(0 && "emscripten fastcomp does not support c++ exceptions and setjmp/longjmp together yet. disable exceptions (-s DISABLE_EXCEPTION_CATCHING=1) or remove setjmp from your code, for now, or use the original emscripten compiler instead of fastcomp.");
+ }
+ }
+
// Add functions
Type *i32 = Type::getInt32Ty(M.getContext());
diff --git a/lib/Transforms/NaCl/PNaClABISimplify.cpp b/lib/Transforms/NaCl/PNaClABISimplify.cpp
index 356c21e6e5..3b08d97425 100644
--- a/lib/Transforms/NaCl/PNaClABISimplify.cpp
+++ b/lib/Transforms/NaCl/PNaClABISimplify.cpp
@@ -47,9 +47,9 @@ void llvm::PNaClABISimplifyAddPreOptPasses(PassManager &PM) {
PM.add(createLowerInvokePass());
// Remove landingpad blocks made unreachable by LowerInvoke.
PM.add(createCFGSimplificationPass());
- }
- //PM.add(createLowerEmSetjmpPass()); // XXX EMSCRIPTEN
+ //PM.add(createLowerEmSetjmpPass()); // XXX EMSCRIPTEN . Note, only if no exceptions
+ }
#if 0 // EMSCRIPTEN: we allow arbitrary symbols to be preserved
// Internalize all symbols in the module except _start, which is the only