From c3e4e5654d02106a19f315b736d56acb581246f9 Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Tue, 23 Oct 2012 19:30:58 +0800 Subject: Workaround for Android __cxa_finalize bug Used to be local NDK patch at $NDK/build/tools/toolchain-patches/ gcc/0003-Work-around-for-Android-__cxa_finalize-bug.patch Change-Id: I8f8039ba010af169185de6f276a45317ecd42170 --- gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc | 8 ++++++++ gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc | 8 ++++++++ gcc-4.7/libstdc++-v3/libsupc++/eh_globals.cc | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc b/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc index 63f46a99e..845b6d1ae 100644 --- a/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc +++ b/gcc-4.4.3/libstdc++-v3/libsupc++/eh_globals.cc @@ -101,6 +101,14 @@ struct __eh_globals_init ~__eh_globals_init() { + /* Work-around for an Android-specific bug, where this destructor + * is called with a NULL object pointer. This is due to a bug in the + * __cxa_finalize() implementation that was only fixed in 2.2. + */ +#ifdef __ANDROID__ + if (this == NULL) + return; +#endif if (_M_init) __gthread_key_delete(_M_key); _M_init = false; diff --git a/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc b/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc index 63f46a99e..845b6d1ae 100644 --- a/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc +++ b/gcc-4.6/libstdc++-v3/libsupc++/eh_globals.cc @@ -101,6 +101,14 @@ struct __eh_globals_init ~__eh_globals_init() { + /* Work-around for an Android-specific bug, where this destructor + * is called with a NULL object pointer. This is due to a bug in the + * __cxa_finalize() implementation that was only fixed in 2.2. + */ +#ifdef __ANDROID__ + if (this == NULL) + return; +#endif if (_M_init) __gthread_key_delete(_M_key); _M_init = false; diff --git a/gcc-4.7/libstdc++-v3/libsupc++/eh_globals.cc b/gcc-4.7/libstdc++-v3/libsupc++/eh_globals.cc index 0c7f6b760..fa9b5196b 100644 --- a/gcc-4.7/libstdc++-v3/libsupc++/eh_globals.cc +++ b/gcc-4.7/libstdc++-v3/libsupc++/eh_globals.cc @@ -101,6 +101,14 @@ struct __eh_globals_init ~__eh_globals_init() { + /* Work-around for an Android-specific bug, where this destructor + * is called with a NULL object pointer. This is due to a bug in the + * __cxa_finalize() implementation that was only fixed in 2.2. + */ +#ifdef __ANDROID__ + if (this == NULL) + return; +#endif if (_M_init) __gthread_key_delete(_M_key); _M_init = false; -- cgit v1.2.3