aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-22 11:23:32 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-22 11:23:32 -0800
commitdd979ed995ce4a82b505fba2f29a8f32dc900bdd (patch)
treea6f11f4ad5d17bfcfbcc53b0f477b60e7dff2dd7
parentf53e69d92372020949c5ac0ca8f5ffdc67fb42fb (diff)
bundle libcxxabi
-rw-r--r--system/lib/libcxxabi/CREDITS.TXT22
-rw-r--r--system/lib/libcxxabi/LICENSE.TXT76
-rw-r--r--system/lib/libcxxabi/Makefile27
-rw-r--r--system/lib/libcxxabi/include/cxa_demangle.h167
-rw-r--r--system/lib/libcxxabi/include/cxxabi.h175
-rwxr-xr-xsystem/lib/libcxxabi/lib/buildit90
-rw-r--r--system/lib/libcxxabi/readme.txt1
-rw-r--r--system/lib/libcxxabi/src/abort_message.cpp60
-rw-r--r--system/lib/libcxxabi/src/abort_message.h33
-rw-r--r--system/lib/libcxxabi/src/cxa_aux_runtime.cpp34
-rw-r--r--system/lib/libcxxabi/src/cxa_demangle.cpp10798
-rw-r--r--system/lib/libcxxabi/src/cxa_exception.cpp622
-rw-r--r--system/lib/libcxxabi/src/cxa_exception.hpp118
-rw-r--r--system/lib/libcxxabi/src/cxa_exception_storage.cpp91
-rw-r--r--system/lib/libcxxabi/src/cxa_guard.cpp231
-rw-r--r--system/lib/libcxxabi/src/cxa_handlers.cpp196
-rw-r--r--system/lib/libcxxabi/src/cxa_handlers.hpp26
-rw-r--r--system/lib/libcxxabi/src/cxa_new_delete.cpp231
-rw-r--r--system/lib/libcxxabi/src/cxa_personality.cpp987
-rw-r--r--system/lib/libcxxabi/src/cxa_unexpected.cpp27
-rw-r--r--system/lib/libcxxabi/src/cxa_vector.cpp367
-rw-r--r--system/lib/libcxxabi/src/cxa_virtual.cpp31
-rw-r--r--system/lib/libcxxabi/src/exception.cpp41
-rw-r--r--system/lib/libcxxabi/src/fallback_malloc.ipp174
-rw-r--r--system/lib/libcxxabi/src/private_typeinfo.cpp1036
-rw-r--r--system/lib/libcxxabi/src/private_typeinfo.h246
-rw-r--r--system/lib/libcxxabi/src/stdexcept.cpp122
-rw-r--r--system/lib/libcxxabi/src/temporary.cpp41
-rw-r--r--system/lib/libcxxabi/src/typeinfo.cpp53
29 files changed, 16123 insertions, 0 deletions
diff --git a/system/lib/libcxxabi/CREDITS.TXT b/system/lib/libcxxabi/CREDITS.TXT
new file mode 100644
index 00000000..a99245f7
--- /dev/null
+++ b/system/lib/libcxxabi/CREDITS.TXT
@@ -0,0 +1,22 @@
+This file is a partial list of people who have contributed to the LLVM/libc++abi
+project. If you have contributed a patch or made some other contribution to
+LLVM/libc++abi, please submit a patch to this file to add yourself, and it will be
+done!
+
+The list is sorted by surname and formatted to allow easy grepping and
+beautification by scripts. The fields are: name (N), email (E), web-address
+(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
+(S).
+
+N: Howard Hinnant
+E: hhinnant@apple.com
+D: Architect and primary coauthor of libc++abi
+
+N: Marshall Clow
+E: marshall@idio.com
+E: mclow.lists@gmail.com
+E: mclow@qualcomm.com
+D: Architect and primary coauthor of libc++abi
+
+N: Nick Kledzik
+E: kledzik@apple.com
diff --git a/system/lib/libcxxabi/LICENSE.TXT b/system/lib/libcxxabi/LICENSE.TXT
new file mode 100644
index 00000000..40ce7c7d
--- /dev/null
+++ b/system/lib/libcxxabi/LICENSE.TXT
@@ -0,0 +1,76 @@
+==============================================================================
+libc++abi License
+==============================================================================
+
+The libc++abi library is dual licensed under both the University of Illinois
+"BSD-Like" license and the MIT license. As a user of this code you may choose
+to use it under either license. As a contributor, you agree to allow your code
+to be used under both.
+
+Full text of the relevant licenses is included below.
+
+==============================================================================
+
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+
+Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/system/lib/libcxxabi/Makefile b/system/lib/libcxxabi/Makefile
new file mode 100644
index 00000000..86d88976
--- /dev/null
+++ b/system/lib/libcxxabi/Makefile
@@ -0,0 +1,27 @@
+OBJECTS = \
+ cxa_vector.bc \
+ private_typeinfo.bc \
+ cxa_virtual.bc \
+ temporary.bc \
+ cxa_guard.bc \
+ cxa_unexpected.bc \
+ cxa_exception.bc \
+ cxa_aux_runtime.bc \
+ exception.bc \
+ stdexcept.bc \
+ abort_message.bc \
+ cxa_personality.bc \
+ cxa_new_delete.bc \
+ cxa_handlers.bc \
+ cxa_exception_storage.bc \
+ typeinfo.bc \
+ cxa_demangle.bc
+
+all: libcxx.bc
+
+%.bc: %.cpp
+ $(CXX) $< -o $@
+
+libcxx.bc: $(OBJECTS)
+ $(CXX) $(OBJECTS) -o libcxxabi.bc
+
diff --git a/system/lib/libcxxabi/include/cxa_demangle.h b/system/lib/libcxxabi/include/cxa_demangle.h
new file mode 100644
index 00000000..46dc9821
--- /dev/null
+++ b/system/lib/libcxxabi/include/cxa_demangle.h
@@ -0,0 +1,167 @@
+//===-------------------------- cxa_demangle.h ----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _CXA_DEMANGLE_H
+#define _CXA_DEMANGLE_H
+
+#include <cxxabi.h>
+
+#pragma GCC visibility push(hidden)
+
+namespace __cxxabiv1
+{
+
+namespace __libcxxabi
+{
+
+class __demangle_tree;
+class __node;
+
+char*
+__demangle(__demangle_tree, char*, size_t*, int*);
+
+struct __demangle_tree_rv
+{
+ __demangle_tree* ptr_;
+
+ explicit __demangle_tree_rv(__demangle_tree* ptr)
+ : ptr_(ptr) {}
+};
+
+class __demangle_tree
+{
+ const char* __mangled_name_begin_;
+ const char* __mangled_name_end_;
+ int __status_;
+ __node* __root_;
+ __node* __node_begin_;
+ __node* __node_end_;
+ __node* __node_cap_;
+ __node** __sub_begin_;
+ __node** __sub_end_;
+ __node** __sub_cap_;
+ __node** __t_begin_;
+ __node** __t_end_;
+ __node** __t_cap_;
+ bool __tag_templates_;
+ bool __fix_forward_references_;
+ bool __owns_buf_;
+
+ __demangle_tree& operator=(const __demangle_tree&);
+public:
+ __demangle_tree(const char*, char*, size_t);
+ ~__demangle_tree();
+
+ __demangle_tree(__demangle_tree&);
+ __demangle_tree(__demangle_tree_rv);
+ operator __demangle_tree_rv() {return __demangle_tree_rv(this);}
+
+ int __status() const;
+ size_t size() const;
+ char* __get_demangled_name(char*) const;
+
+ void __parse();
+
+private:
+ const char* __parse_encoding(const char*, const char*);
+ const char* __parse_type(const char*, const char*,
+ bool = true, bool = false);
+ const char* __parse_special_name(const char*, const char*);
+ const char* __parse_name(const char*, const char*);
+ const char* __parse_bare_function_type(const char*, const char*);
+ const char* __parse_call_offset(const char*, const char*);
+ const char* __parse_number(const char*, const char*);
+ const char* __parse_cv_qualifiers(const char* first, const char* last,
+ unsigned& cv, bool = false);
+ const char* __parse_nested_name(const char*, const char*);
+ const char* __parse_discriminator(const char*, const char*);
+ const char* __parse_local_name(const char*, const char*);
+ const char* __parse_unscoped_template_name(const char*, const char*);
+ const char* __parse_unscoped_name(const char*, const char*);
+ const char* __parse_operator_name(const char*, const char*, int* = 0);
+ const char* __parse_unqualified_name(const char*, const char*);
+ const char* __parse_source_name(const char*, const char*);
+ const char* __parse_ctor_dtor_name(const char*, const char*);
+ const char* __parse_unnamed_type_name(const char*, const char*);
+ const char* __parse_template_args(const char*, const char*);
+ const char* __parse_template_arg(const char*, const char*);
+ const char* __parse_expression(const char*, const char*);
+ const char* __parse_expr_primary(const char*, const char*);
+ const char* __parse_substitution(const char*, const char*);
+ const char* __parse_builtin_type(const char*, const char*);
+ const char* __parse_function_type(const char*, const char*);
+ const char* __parse_class_enum_type(const char*, const char*);
+ const char* __parse_array_type(const char*, const char*);
+ const char* __parse_pointer_to_member_type(const char*, const char*);
+ const char* __parse_decltype(const char*, const char*);
+ const char* __parse_template_param(const char*, const char*);
+ const char* __parse_unresolved_name(const char*, const char*);
+ const char* __parse_unresolved_type(const char*, const char*);
+ const char* __parse_base_unresolved_name(const char*, const char*);
+ const char* __parse_simple_id(const char*, const char*);
+ const char* __parse_destructor_name(const char*, const char*);
+ const char* __parse_function_param(const char*, const char*);
+ const char* __parse_const_cast_expr(const char*, const char*);
+ const char* __parse_alignof_expr(const char*, const char*);
+ const char* __parse_call_expr(const char*, const char*);
+ const char* __parse_conversion_expr(const char*, const char*);
+ const char* __parse_delete_array_expr(const char*, const char*);
+ const char* __parse_delete_expr(const char*, const char*);
+ const char* __parse_dynamic_cast_expr(const char*, const char*);
+ const char* __parse_dot_star_expr(const char*, const char*);
+ const char* __parse_dot_expr(const char*, const char*);
+ const char* __parse_decrement_expr(const char*, const char*);
+ const char* __parse_new_expr(const char*, const char*);
+ const char* __parse_increment_expr(const char*, const char*);
+ const char* __parse_arrow_expr(const char*, const char*);
+ const char* __parse_reinterpret_cast_expr(const char*, const char*);
+ const char* __parse_static_cast_expr(const char*, const char*);
+ const char* __parse_sizeof_type_expr(const char*, const char*);
+ const char* __parse_sizeof_param_pack_expr(const char*, const char*);
+ const char* __parse_typeid_expr(const char*, const char*);
+ const char* __parse_throw_expr(const char*, const char*);
+ const char* __parse_pack_expansion(const char*, const char*);
+ const char* __parse_sizeof_function_param_pack_expr(const char*, const char*);
+ const char* __parse_dot_suffix(const char*, const char*);
+ const char* __parse_unresolved_qualifier_level(const char*, const char*);
+ const char* __parse_vector_type(const char*, const char*);
+ const char* __parse_hex_number(const char*, const char*, unsigned long long&);
+
+ template <class _Tp> bool __make();
+ template <class _Tp, class _A0> bool __make(_A0 __a0);
+ template <class _Tp, class _A0, class _A1> bool __make(_A0 __a0, _A1 __a1);
+ template <class _Tp, class _A0, class _A1, class _A2>
+ bool __make(_A0 __a0, _A1 __a1, _A2 __a2);
+ template <class _Tp, class _A0, class _A1, class _A2, class _A3>
+ bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3);
+ template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4>
+ bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4);
+ template <class _Tp, class _A0, class _A1, class _A2, class _A3, class _A4,
+ class _A5>
+ bool __make(_A0 __a0, _A1 __a1, _A2 __a2, _A3 __a3, _A4 __a4, _A5 __a5);
+
+ friend
+ char*
+ __demangle(__demangle_tree, char*, size_t*, int*);
+
+};
+
+__demangle_tree
+__demangle(const char*);
+
+__demangle_tree
+__demangle(const char*, char*, size_t);
+
+} // __libcxxabi
+} // __cxxabiv1
+
+#pragma GCC visibility pop
+
+
+#endif // _CXA_DEMANGLE_H
diff --git a/system/lib/libcxxabi/include/cxxabi.h b/system/lib/libcxxabi/include/cxxabi.h
new file mode 100644
index 00000000..b08fba0e
--- /dev/null
+++ b/system/lib/libcxxabi/include/cxxabi.h
@@ -0,0 +1,175 @@
+//===--------------------------- cxxabi.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __CXXABI_H
+#define __CXXABI_H
+
+/*
+ * This header provides the interface to the C++ ABI as defined at:
+ * http://www.codesourcery.com/cxx-abi/
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+
+#define _LIBCPPABI_VERSION 1001
+#define LIBCXXABI_NORETURN __attribute__((noreturn))
+
+#ifdef __cplusplus
+
+namespace std {
+ class type_info; // forward declaration
+}
+
+
+// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
+namespace __cxxabiv1 {
+ extern "C" {
+
+// 2.4.2 Allocating the Exception Object
+extern void * __cxa_allocate_exception(size_t thrown_size) throw();
+extern void __cxa_free_exception(void * thrown_exception) throw();
+
+// 2.4.3 Throwing the Exception Object
+extern LIBCXXABI_NORETURN void __cxa_throw(void * thrown_exception,
+ std::type_info * tinfo, void (*dest)(void *));
+
+// 2.5.3 Exception Handlers
+extern void * __cxa_get_exception_ptr(void * exceptionObject) throw();
+extern void * __cxa_begin_catch(void * exceptionObject) throw();
+extern void __cxa_end_catch();
+extern std::type_info * __cxa_current_exception_type();
+
+// 2.5.4 Rethrowing Exceptions
+extern LIBCXXABI_NORETURN void __cxa_rethrow();
+
+
+
+// 2.6 Auxiliary Runtime APIs
+extern LIBCXXABI_NORETURN void __cxa_bad_cast(void);
+extern LIBCXXABI_NORETURN void __cxa_bad_typeid(void);
+
+
+
+// 3.2.6 Pure Virtual Function API
+extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
+
+// 3.2.7 Deleted Virtual Function API
+extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
+
+// 3.3.2 One-time Construction API
+#ifdef LIBCXXABI_ARMEABI
+extern int __cxa_guard_acquire(uint32_t*);
+extern void __cxa_guard_release(uint32_t*);
+extern void __cxa_guard_abort(uint32_t*);
+#else
+extern int __cxa_guard_acquire(uint64_t*);
+extern void __cxa_guard_release(uint64_t*);
+extern void __cxa_guard_abort(uint64_t*);
+#endif
+
+// 3.3.3 Array Construction and Destruction API
+extern void* __cxa_vec_new(size_t element_count,
+ size_t element_size,
+ size_t padding_size,
+ void (*constructor)(void*),
+ void (*destructor)(void*) );
+
+extern void* __cxa_vec_new2(size_t element_count,
+ size_t element_size,
+ size_t padding_size,
+ void (*constructor)(void*),
+ void (*destructor)(void*),
+ void* (*alloc)(size_t),
+ void (*dealloc)(void*) );
+
+extern void* __cxa_vec_new3(size_t element_count,
+ size_t element_size,
+ size_t padding_size,
+ void (*constructor)(void*),
+ void (*destructor)(void*),
+ void* (*alloc)(size_t),
+ void (*dealloc)(void*, size_t) );
+
+extern void __cxa_vec_ctor(void* array_address,
+ size_t element_count,
+ size_t element_size,
+ void (*constructor)(void*),
+ void (*destructor)(void*) );
+
+
+extern void __cxa_vec_dtor(void* array_address,
+ size_t element_count,
+ size_t element_size,
+ void (*destructor)(void*) );
+
+
+extern void __cxa_vec_cleanup(void* array_address,
+ size_t element_count,
+ size_t element_size,
+ void (*destructor)(void*) );
+
+
+extern void __cxa_vec_delete(void* array_address,
+ size_t element_size,
+ size_t padding_size,
+ void (*destructor)(void*) );
+
+
+extern void __cxa_vec_delete2(void* array_address,
+ size_t element_size,
+ size_t padding_size,
+ void (*destructor)(void*),
+ void (*dealloc)(void*) );
+
+
+extern void __cxa_vec_delete3(void* __array_address,
+ size_t element_size,
+ size_t padding_size,
+ void (*destructor)(void*),
+ void (*dealloc) (void*, size_t));
+
+
+extern void __cxa_vec_cctor(void* dest_array,
+ void* src_array,
+ size_t element_count,
+ size_t element_size,
+ void (*constructor) (void*, void*),
+ void (*destructor)(void*) );
+
+
+// 3.3.5.3 Runtime API
+extern int __cxa_atexit(void (*f)(void*), void* p, void* d);
+extern int __cxa_finalize(void*);
+
+
+// 3.4 Demangler API
+extern char* __cxa_demangle(const char* mangled_name,
+ char* output_buffer,
+ size_t* length,
+ int* status);
+
+// Apple additions to support C++ 0x exception_ptr class
+// These are primitives to wrap a smart pointer around an exception object
+extern void * __cxa_current_primary_exception() throw();
+extern void __cxa_rethrow_primary_exception(void* primary_exception);
+extern void __cxa_increment_exception_refcount(void* primary_exception) throw();
+extern void __cxa_decrement_exception_refcount(void* primary_exception) throw();
+
+// Apple addition to support std::uncaught_exception()
+extern bool __cxa_uncaught_exception() throw();
+
+ } // extern "C"
+} // namespace __cxxabiv1
+
+#endif // __cplusplus
+
+namespace abi = __cxxabiv1;
+
+#endif // __CXXABI_H
diff --git a/system/lib/libcxxabi/lib/buildit b/system/lib/libcxxabi/lib/buildit
new file mode 100755
index 00000000..d1d2acda
--- /dev/null
+++ b/system/lib/libcxxabi/lib/buildit
@@ -0,0 +1,90 @@
+#! /bin/sh
+#
+# Set the $TRIPLE environment variable to your system's triple before
+# running this script. If you set $CXX, that will be used to compile
+# the library. Otherwise we'll use clang++.
+
+set -e
+
+if [ `basename $(pwd)` != "lib" ]
+then
+ echo "current directory must be lib"
+ exit 1
+fi
+
+if [ -z "$CXX" ]
+then
+ CXX=clang++
+fi
+
+if [ -z "$CC" ]
+then
+ CC=clang
+fi
+
+if [ -z $RC_ProjectSourceVersion ]
+then
+ RC_ProjectSourceVersion=1
+fi
+
+EXTRA_FLAGS="-std=c++0x -stdlib=libc++ -fstrict-aliasing -Wstrict-aliasing=2 -Wnewline-eof"
+
+case $TRIPLE in
+ *-apple-*)
+ if [ -z $RC_XBS ]
+ then
+ RC_CFLAGS="-arch i386 -arch x86_64"
+ fi
+ SOEXT=dylib
+ if [ -n "$SDKROOT" ]
+ then
+ EXTRA_FLAGS+="-isysroot ${SDKROOT}"
+ CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
+ CC=`xcrun -sdk "${SDKROOT}" -find clang`
+ fi
+ LDSHARED_FLAGS="-o libc++abi.dylib \
+ -dynamiclib -nodefaultlibs \
+ -current_version ${RC_ProjectSourceVersion} \
+ -compatibility_version 1 \
+ -install_name /usr/lib/libc++abi.dylib \
+ -lSystem"
+ ;;
+ *-*-mingw*)
+ # FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt
+ SOEXT=dll
+ LDSHARED_FLAGS="-o libc++abi.dll \
+ -shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++abi.dll.a \
+ -lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
+ ;;
+ *)
+ RC_CFLAGS="-fPIC"
+ SOEXT=so
+ LDSHARED_FLAGS="-o libc++abi.so.1.0 \
+ -shared -nodefaultlibs -Wl,-soname,libc++abi.so.1 \
+ -lpthread -lrt -lc -lstdc++"
+ ;;
+esac
+
+if [ -z $RC_XBS ]
+then
+ rm -f libc++abi.1.$SOEXT*
+fi
+
+set -x
+
+for FILE in ../src/*.cpp; do
+ $CXX -c -g -O3 $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
+done
+case $TRIPLE in
+ *-*-mingw*)
+ for FILE in ../src/support/win32/*.cpp; do
+ $CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
+ done
+ ;;
+esac
+$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
+
+if [ -z $RC_XBS ]
+then
+ rm *.o
+fi
diff --git a/system/lib/libcxxabi/readme.txt b/system/lib/libcxxabi/readme.txt
new file mode 100644
index 00000000..0be9a318
--- /dev/null
+++ b/system/lib/libcxxabi/readme.txt
@@ -0,0 +1 @@
+These files are from libcxxabi, svn revision 151132, Feb 22 2012
diff --git a/system/lib/libcxxabi/src/abort_message.cpp b/system/lib/libcxxabi/src/abort_message.cpp
new file mode 100644
index 00000000..7beb86b5
--- /dev/null
+++ b/system/lib/libcxxabi/src/abort_message.cpp
@@ -0,0 +1,60 @@
+//===------------------------- abort_message.cpp --------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include "abort_message.h"
+
+#pragma GCC visibility push(hidden)
+
+#if __APPLE__
+# if defined(__has_include) && __has_include(<CrashReporterClient.h>)
+# define HAVE_CRASHREPORTERCLIENT_H 1
+# include <CrashReporterClient.h>
+
+ // If any clients of llvm try to link to libCrashReporterClient.a themselves,
+ // only one crash info struct will be used.
+ extern "C" {
+ CRASH_REPORTER_CLIENT_HIDDEN
+ struct crashreporter_annotations_t gCRAnnotations
+ __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION)))
+ = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
+ }
+
+# endif
+#endif
+
+__attribute__((visibility("hidden"), noreturn))
+void abort_message(const char* format, ...)
+{
+ // write message to stderr
+#if __APPLE__
+ fprintf(stderr, "libc++abi.dylib: ");
+#endif
+ va_list list;
+ va_start(list, format);
+ vfprintf(stderr, format, list);
+ va_end(list);
+ fprintf(stderr, "\n");
+
+#if __APPLE__ && HAVE_CRASHREPORTERCLIENT_H
+ // record message in crash report
+ char* buffer;
+ va_list list2;
+ va_start(list2, format);
+ vasprintf(&buffer, format, list2);
+ va_end(list2);
+ CRSetCrashLogMessage(buffer);
+#endif
+
+ abort();
+}
+
+#pragma GCC visibility pop
diff --git a/system/lib/libcxxabi/src/abort_message.h b/system/lib/libcxxabi/src/abort_message.h
new file mode 100644
index 00000000..2c5cb204
--- /dev/null
+++ b/system/lib/libcxxabi/src/abort_message.h
@@ -0,0 +1,33 @@
+//===-------------------------- abort_message.h-----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __ABORT_MESSAGE_H_
+#define __ABORT_MESSAGE_H_
+
+#include <stdio.h>
+
+#pragma GCC visibility push(hidden)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+__attribute__((visibility("hidden"), noreturn))
+ void abort_message(const char* format, ...)
+ __attribute__((format(printf, 1, 2)));
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#pragma GCC visibility pop
+
+#endif
+
diff --git a/system/lib/libcxxabi/src/cxa_aux_runtime.cpp b/system/lib/libcxxabi/src/cxa_aux_runtime.cpp
new file mode 100644
index 00000000..abd8091c
--- /dev/null
+++ b/system/lib/libcxxabi/src/cxa_aux_runtime.cpp
@@ -0,0 +1,34 @@
+//===------------------------ cxa_aux_runtime.cpp -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//
+// This file implements the "Auxiliary Runtime APIs"
+// http://www.codesourcery.com/public/cxx-abi/abi-eh.html#cxx-aux
+//===----------------------------------------------------------------------===//
+
+#include "cxxabi.h"
+#include <typeinfo>
+
+namespace __cxxabiv1
+{
+
+extern "C"
+{
+
+LIBCXXABI_NORETURN
+void __cxa_bad_cast (void) {
+ throw std::bad_cast();
+}
+
+LIBCXXABI_NORETURN
+void __cxa_bad_typeid(void) {
+ throw std::bad_typeid();
+}
+
+} // extern "C"
+
+} // abi
diff --git a/system/lib/libcxxabi/src/cxa_demangle.cpp b/system/lib/libcxxabi/src/cxa_demangle.cpp
new file mode 100644
index 00000000..1135c99b
--- /dev/null
+++ b/system/lib/libcxxabi/src/cxa_demangle.cpp
@@ -0,0 +1,10798 @@
+//===-------------------------- cxa_demangle.cpp --------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "cxa_demangle.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <new>
+#include <algorithm>
+#include <assert.h>
+
+
+#ifdef DEBUGGING
+
+#include <string>
+#include <typeinfo>
+
+#endif
+
+namespace __cxxabiv1
+{
+
+namespace __libcxxabi
+{
+
+#pragma GCC visibility push(hidden)
+
+class __node
+{
+ __node(const __node&);
+ __node& operator=(const __node&);
+public:
+ const char* __name_;
+ size_t __size_;
+ __node* __left_;
+ __node* __right_;
+ long double __value_;
+ long __cached_size_;
+public:
+ __node()
+ : __name_(0), __size_(0), __left_(0), __right_(0), __cached_size_(-1)
+ {}
+ virtual ~__node() {};
+
+ void reset_cached_size()
+ {
+ __cached_size_ = -1;
+ if (__left_)
+ __left_->reset_cached_size();
+ if (__right_)
+ __right_->reset_cached_size();
+ }
+
+ virtual size_t first_size() const {return 0;}
+ virtual size_t second_size() const {return 0;}
+ virtual size_t size() const
+ {
+ if (__cached_size_ == -1)
+ const_cast<long&>(__cached_size_) = first_size() + second_size();
+ return __cached_size_;
+ }
+ virtual char* first_demangled_name(char* buf) const {return buf;}
+ virtual char* second_demangled_name(char* buf) const {return buf;}
+ virtual char* get_demangled_name(char* buf) const
+ {
+ return second_demangled_name(first_demangled_name(buf));
+ }
+ virtual size_t base_size() const {return size();}
+ virtual char* get_base_name(char* buf) const
+ {
+ return get_demangled_name(buf);
+ }
+
+ virtual bool ends_with_template(bool parsing = false) const
+ {
+ return false;
+ }
+ virtual bool is_ctor_dtor_conv() const
+ {
+ return false;
+ }
+ virtual __node* base_name() const
+ {
+ return const_cast<__node*>(this);
+