From e5bf7828d96a6e8f7438e432ed7b7aca135aa47a Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Tue, 10 Jul 2012 23:03:48 +0200 Subject: [PATCH] Add missing unwind code to cxx lib This patch adds support for the '_Unwind_Complete()' and '_Unwind_DeleteException()' functions in the cxx lib. Fixes #275. --- base/lib/import/import-stdcxx.mk | 3 +++ base/lib/mk/cxx.mk | 2 +- base/src/base/cxx/unwind.cc | 10 +++++++++- os/src/lib/ldso/symbol.map | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/base/lib/import/import-stdcxx.mk b/base/lib/import/import-stdcxx.mk index 14c96db2e..003d15b3c 100644 --- a/base/lib/import/import-stdcxx.mk +++ b/base/lib/import/import-stdcxx.mk @@ -15,6 +15,9 @@ INC_DIR += $(shell echo "int main() {return 0;}" |\ sed '/^\#include <\.\.\.> search starts here:/,/^End of search list/!d' |\ grep "c++") +# avoid multiple definition of type _mbstate_t +CC_CXX_OPT += -D_GLIBCXX_HAVE_MBSTATE_T + # # Link libstdc++ that comes with the tool chain # diff --git a/base/lib/mk/cxx.mk b/base/lib/mk/cxx.mk index ca1f9d171..2185c7c38 100644 --- a/base/lib/mk/cxx.mk +++ b/base/lib/mk/cxx.mk @@ -15,7 +15,7 @@ LIBC_SYMBOLS += malloc free calloc realloc \ # # Symbols we wrap (see unwind.cc) # -EH_SYMBOLS = _Unwind_Resume +EH_SYMBOLS = _Unwind_Resume _Unwind_Complete _Unwind_DeleteException # # Additional functions for ARM diff --git a/base/src/base/cxx/unwind.cc b/base/src/base/cxx/unwind.cc index 41995c5e9..265387a38 100644 --- a/base/src/base/cxx/unwind.cc +++ b/base/src/base/cxx/unwind.cc @@ -27,9 +27,13 @@ extern "C" { /* Unwind function found in all binaries */ void _cxx__Unwind_Resume(void *exc) __attribute__((weak)); - void __cxx__Unwind_Resume(void *exc) { + void __cxx__Unwind_Resume(void *exc) { _cxx__Unwind_Resume(exc); } + void _cxx__Unwind_DeleteException(void *exc) __attribute__((weak)); + void __cxx__Unwind_DeleteException(void *exc) { + _cxx__Unwind_DeleteException(exc); } + /* Special ARM-EABI personality functions */ #ifdef __ARM_EABI__ @@ -41,5 +45,9 @@ extern "C" { int __cxx___aeabi_unwind_cpp_pr1(int state, void *block, void *context) { return _cxx___aeabi_unwind_cpp_pr1(state, block, context); } + /* Unwind functions found in some binaries */ + void _cxx__Unwind_Complete(void *exc) __attribute__((weak)); + void __cxx__Unwind_Complete(void *exc) { + _cxx__Unwind_Complete(exc); } #endif } diff --git a/os/src/lib/ldso/symbol.map b/os/src/lib/ldso/symbol.map index 661abdb99..ee7f741d9 100644 --- a/os/src/lib/ldso/symbol.map +++ b/os/src/lib/ldso/symbol.map @@ -54,6 +54,8 @@ /* x86 */ __cxa*; + _Unwind_Complete; + _Unwind_DeleteException; _Unwind_Resume; __gxx_personality_v0;