build enough of libcxxabi to support bad_typeid without undefined symbols; 1.21.5; fixes #2547
This commit is contained in:
Родитель
7bb5b82e98
Коммит
92f653eed8
|
@ -1,2 +1,2 @@
|
|||
1.21.4
|
||||
1.21.5
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче