aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-07-21 11:23:35 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-07-21 11:25:08 -0700
commit92f653eed8ca32dec307ef335b3e98c9ccc4ab67 (patch)
treee8c0ec57f5cd2d585ed93ecfe8227bfde75ae084
parent7bb5b82e988070bf02c8dae115ed7dabae88cfa1 (diff)
build enough of libcxxabi to support bad_typeid without undefined symbols; 1.21.5; fixes #2547
-rw-r--r--emscripten-version.txt2
-rw-r--r--tests/test_core.py28
-rw-r--r--tools/system_libs.py10
3 files changed, 38 insertions, 2 deletions
diff --git a/emscripten-version.txt b/emscripten-version.txt
index a08cf9ed..578c0895 100644
--- a/emscripten-version.txt
+++ b/emscripten-version.txt
@@ -1,2 +1,2 @@
-1.21.4
+1.21.5
diff --git a/tests/test_core.py b/tests/test_core.py
index eaeb813b..6ede7577 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1477,6 +1477,34 @@ int main(int argc, char **argv)
src, output = (test_path + s for s in ('.c', '.out'))
self.do_run_from_file(src, output)
+ def test_bad_typeid(self):
+ if self.emcc_args is None: return self.skip('requires emcc')
+
+ Settings.ERROR_ON_UNDEFINED_SYMBOLS = 1
+ Settings.DISABLE_EXCEPTION_CATCHING = 0
+
+ self.do_run(r'''
+// exception example
+#include <iostream> // std::cerr
+#include <typeinfo> // operator typeid
+#include <exception> // std::exception
+
+class Polymorphic {virtual void member(){}};
+
+int main () {
+ try
+ {
+ Polymorphic * pb = 0;
+ typeid(*pb); // throws a bad_typeid exception
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "exception caught: " << e.what() << '\n';
+ }
+ return 0;
+}
+ ''', 'exception caught: std::bad_typeid')
+
def test_exit_stack(self):
if self.emcc_args is None: return self.skip('requires emcc')
if Settings.ASM_JS: return self.skip('uses report_stack without exporting')
diff --git a/tools/system_libs.py b/tools/system_libs.py
index 0cfa7d1a..9586f98e 100644
--- a/tools/system_libs.py
+++ b/tools/system_libs.py
@@ -27,7 +27,7 @@ def calculate(temp_files, in_temp, stdout_, stderr_):
symbols = filter(lambda symbol: symbol not in exclude, symbols)
return set(symbols)
- lib_opts = ['-O2']
+ lib_opts = ['-O2', '-I' + shared.path_from_root('system', 'lib', 'libcxxabi', 'include')]
# XXX We also need to add libc symbols that use malloc, for example strdup. It's very rare to use just them and not
# a normal malloc symbol (like free, after calling strdup), so we haven't hit this yet, but it is possible.
@@ -421,7 +421,15 @@ def calculate(temp_files, in_temp, stdout_, stderr_):
def create_libcxxabi():
logging.debug('building libcxxabi for cache')
libcxxabi_files = [
+ 'abort_message.cpp',
+ 'cxa_aux_runtime.cpp',
+ 'cxa_default_handlers.cpp',
+ 'cxa_demangle.cpp',
+ 'cxa_exception_storage.cpp',
+ 'cxa_new_delete.cpp',
+ 'cxa_handlers.cpp',
'exception.cpp',
+ 'stdexcept.cpp',
'typeinfo.cpp',
'private_typeinfo.cpp',
]