Check in the initial version of libgabi++ for RTTI support.

Change-Id: I51f94a2fd4324fbf172b39ee33f86b915e6f9f69
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..ddbc353
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,51 @@
+LOCAL_PATH:= $(call my-dir)
+
+libgabi++_cflags := \
+	-I$(LOCAL_PATH)/include 
+
+libgabi++_common_src_files := \
+	src/array_type_info.cc \
+	src/class_type_info.cc \
+        src/delete.cc \
+	src/dynamic_cast.cc \
+	src/enum_type_info.cc \
+	src/function_type_info.cc \
+        src/new.cc \
+	src/pbase_type_info.cc \
+	src/pointer_type_info.cc \
+	src/pointer_to_member_type_info.cc \
+	src/si_class_type_info.cc \
+	src/type_info.cc \
+	src/vmi_class_type_info.cc
+
+include $(CLEAR_VARS)
+
+LOCAL_CPP_EXTENSION := .cc
+
+LOCAL_SRC_FILES:= $(libgabi++_common_src_files)
+
+LOCAL_MODULE:= libgabi++
+
+LOCAL_CFLAGS := $(libgabi++_cflags)
+
+LOCAL_RTTI_FLAG := -frtti
+
+LOCAL_SYSTEM_SHARED_LIBRARIES := libc
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_CPP_EXTENSION := .cc
+
+LOCAL_SRC_FILES:= $(libgabi++_common_src_files)
+
+LOCAL_MODULE:= libgabi++
+
+LOCAL_CFLAGS := $(libgabi++_cflags)
+
+LOCAL_RTTI_FLAG := -frtti
+
+LOCAL_SYSTEM_SHARED_LIBRARIES := libc
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/include/cxxabi.h b/include/cxxabi.h
new file mode 100644
index 0000000..3bd8a58
--- /dev/null
+++ b/include/cxxabi.h
@@ -0,0 +1,183 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+
+#ifndef __GABIXX_CXXABI_H__
+#define __GABIXX_CXXABI_H__
+
+#include <typeinfo>
+
+namespace abi = __cxxabiv1;
+
+namespace __cxxabiv1
+{
+  extern "C" void __cxa_pure_virtual();
+
+  // Derived types of type_info below are based on 2.9.5 of C++ ABI.
+
+  // Typeinfo for fundamental types.
+  class __fundamental_type_info : public std::type_info
+  {
+  public:
+    ~__fundamental_type_info();
+  };
+
+  // Typeinfo for array types.
+  class __array_type_info : public std::type_info
+  {
+  public:
+    ~__array_type_info();
+  };
+
+  // Typeinfo for function types.
+  class __function_type_info : public std::type_info
+  {
+  public:
+    ~__function_type_info();
+  };
+
+  // Typeinfo for enum types.
+  class __enum_type_info : public std::type_info
+  {
+  public:
+    ~__enum_type_info();
+  };
+
+  // Typeinfo for classes with no bases.
+  class __class_type_info : public std::type_info
+  {
+  public:
+    ~__class_type_info();
+
+    enum class_type_info_code
+      {
+        CLASS_TYPE_INFO_CODE,
+        SI_CLASS_TYPE_INFO_CODE,
+        VMI_CLASS_TYPE_INFO_CODE
+      };
+
+    virtual class_type_info_code
+    code() const { return CLASS_TYPE_INFO_CODE; }
+  };
+
+  // Typeinfo for classes containing only a single, public, non-virtual base at
+  // offset zero.
+  class __si_class_type_info : public __class_type_info
+  {
+  public:
+    ~__si_class_type_info();
+    const __class_type_info *__base_type;
+
+    virtual __class_type_info::class_type_info_code
+    code() const { return SI_CLASS_TYPE_INFO_CODE; }
+  };
+
+  struct __base_class_type_info
+  {
+  public:
+    const __class_type_info *__base_type;
+
+    // All but the lower __offset_shift bits of __offset_flags are a signed
+    // offset. For a non-virtual base, this is the offset in the object of the
+    // base subobject. For a virtual base, this is the offset in the virtual
+    // table of the virtual base offset for the virtual base referenced
+    // (negative).
+    long __offset_flags;
+
+    enum __offset_flags_masks
+      {
+        __virtual_mask = 0x1,
+        __public_mask = 0x2,
+        __offset_shift = 8
+      };
+
+    bool inline
+    is_virtual() const { return (__offset_flags & __virtual_mask) != 0; }
+
+    bool inline
+    is_public() const { return (__offset_flags & __public_mask) != 0; }
+
+    // FIXME: Right-shift of signed integer is implementation dependent.
+    long inline
+    offset() const { return __offset_flags >> __offset_shift; }
+
+    long inline
+    flags() const { return __offset_flags & ((1L << __offset_shift) - 1); }
+  };
+
+  // Typeinfo for classes with bases that do not satisfy the
+  // __si_class_type_info constraints.
+  class __vmi_class_type_info : public __class_type_info
+  {
+  public:
+    ~__vmi_class_type_info();
+    unsigned int __flags;
+    unsigned int __base_count;
+    __base_class_type_info __base_info[1];
+
+    enum __flags_masks
+      {
+        __non_diamond_repeat_mask = 0x1,
+        __diamond_shaped_mask = 0x2
+      };
+
+    virtual __class_type_info::class_type_info_code
+    code() const { return VMI_CLASS_TYPE_INFO_CODE; }
+  };
+
+  class __pbase_type_info : public std::type_info
+  {
+  public:
+    ~__pbase_type_info();
+    unsigned int __flags;
+    const std::type_info *__pointee;
+
+    enum __masks
+      {
+        __const_mask = 0x1,
+        __volatile_mask = 0x2,
+        __restrict_mask = 0x4,
+        __incomplete_mask = 0x8,
+        __incomplete_class_mask = 0x10
+      };
+  };
+
+  class __pointer_type_info : public __pbase_type_info
+  {
+  public:
+    ~__pointer_type_info();
+  };
+
+  class __pointer_to_member_type_info : public __pbase_type_info
+  {
+  public:
+    ~__pointer_to_member_type_info();
+  };
+}
+
+#endif /* defined(__GABIXX_CXXABI_H__) */
+
diff --git a/include/new b/include/new
new file mode 100644
index 0000000..92dd960
--- /dev/null
+++ b/include/new
@@ -0,0 +1,56 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// new: Dynamic storage management.
+
+#ifndef __GABIXX_NEW__
+#define __GABIXX_NEW__
+
+#include <cstddef>
+
+namespace std
+{
+  struct nothrow_t {};
+  extern const nothrow_t nothrow;
+  typedef void (*new_handler)();
+}
+
+// FIXME: Need to handle exceptions.
+void* operator new(std::size_t size) throw(/*std::bad_alloc*/);
+void* operator new(std::size_t size, const std::nothrow_t&) throw();
+void  operator delete(void* ptr) throw();
+void  operator delete(void*, const std::nothrow_t&) throw();
+void* operator new[](std::size_t size) throw(/*std::bad_alloc*/);
+void* operator new[](std::size_t size, const std::nothrow_t&) throw();
+void  operator delete[](void* ptr) throw();
+void  operator delete[](void* const, std::nothrow_t&) throw();
+void* operator new(std::size_t size, void* ptr) throw();
+void* operator new[](std::size_t size, void* ptr) throw();
+void  operator delete(void* ptr, void*) throw();
+void  operator delete[](void* ptr, void*) throw();
+
+#endif // __GABIXX_NEW__
diff --git a/include/typeinfo b/include/typeinfo
new file mode 100644
index 0000000..ab87f7e
--- /dev/null
+++ b/include/typeinfo
@@ -0,0 +1,76 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// typeinfo: RTTI support header.
+//
+// References:
+// Itanium C++ ABI at http://www.codesourcery.com/public/cxx-abi/abi.html.
+// IHI0041A C++ Application Binary Interface for the ARM architecture.
+// Linux Standard Base C++ Specification for S390X 4.1.
+//
+
+#ifndef __GABIXX_TYPEINFO__
+#define __GABIXX_TYPEINFO__
+
+namespace std
+{
+  // Defintion of type_info based on example in C++ ABI section 2.9.3
+  class type_info
+  {
+  public:
+    virtual
+    ~type_info();
+
+    // Whether two type_infos corresponds to the same types.
+    bool
+    operator==(const type_info &ti) const;
+
+    // Whether two type_infos corresponds to the different types.
+    bool
+    operator!=(const type_info &ti) const;
+
+    bool
+    before(const type_info &ti) const;
+
+    // Return name of type.
+    const char*
+    name() const { return __type_name; }
+
+  private:
+    // Assignment of type_info is not allowed.
+    type_info (const type_info& rhs);
+
+    type_info&
+    operator=(const type_info& rhs);
+
+    // Mangled name of type.
+    const char *__type_name;
+  };
+
+} // namespace std
+
+#endif // _GABIXX_TYPEINFO_
diff --git a/src/array_type_info.cc b/src/array_type_info.cc
new file mode 100644
index 0000000..006f50d
--- /dev/null
+++ b/src/array_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// fundamental_type_info.cc: Methods for __fundamental_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __fundamental_type_info::~__fundamental_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/class_type_info.cc b/src/class_type_info.cc
new file mode 100644
index 0000000..4544542
--- /dev/null
+++ b/src/class_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// class_type_info.cc: Methods for __class_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __class_type_info::~__class_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/delete.cc b/src/delete.cc
new file mode 100644
index 0000000..f13fc49
--- /dev/null
+++ b/src/delete.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// delete.cc: delete operator
+
+#include <stdlib.h>
+#include <new>
+
+void
+operator delete(void* ptr) throw()
+{
+  if (ptr)
+    free(ptr);
+}
diff --git a/src/dynamic_cast.cc b/src/dynamic_cast.cc
new file mode 100644
index 0000000..4487fff
--- /dev/null
+++ b/src/dynamic_cast.cc
@@ -0,0 +1,356 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// dynamic_cast.cc: RTTI support.
+//
+// References:
+// Itanium C++ ABI at http://www.codesourcery.com/public/cxx-abi/abi.html
+// IHI0041A C++ Application Binary Interface for the ARM architecture.
+//
+
+#include <cxxabi.h>
+
+#include <cstddef>
+#include <cassert>
+
+namespace
+{
+  // Adjust a pointer by an offset.
+
+  const void*
+  adjust_pointer(const void* p, std::ptrdiff_t off)
+  {
+    // FIXME: should we align pointer after adjustment?
+    const char *cp = reinterpret_cast<const char*>(p) + off;
+    return reinterpret_cast<const void*>(cp);
+  }
+
+  // Return the vtable pointer of a polymorphic object pointed by p.
+
+  inline const void*
+  get_vtable(const void* p)
+  {
+    return *reinterpret_cast<void*const*>(p);
+  }
+
+  // Return a pointer to a __class_type_info in a vtable.
+
+  inline const abi::__class_type_info*
+  get_class_type_info(const void* vtable)
+  {
+    const void* type_info_ptr = adjust_pointer(vtable, -sizeof(void*));
+    return *reinterpret_cast<abi::__class_type_info*const*>(type_info_ptr);
+  }
+
+  // Return offset to object in a vtable.
+
+  inline std::ptrdiff_t
+  get_offset_to_top(const void* vtable)
+  {
+    const void* type_info_ptr_address = adjust_pointer(vtable, -sizeof(void*));
+    const void* offset_to_top_address =
+      adjust_pointer(type_info_ptr_address, -sizeof(std::ptrdiff_t));
+    return *reinterpret_cast<const std::ptrdiff_t*>(offset_to_top_address);
+  }
+
+  // Return the virtual pointer to the most derived object of referred by a
+  // pointer p.
+
+  const void*
+  get_most_derived_object(const void* p)
+  {
+    const void* vtable = get_vtable(p);
+    std::ptrdiff_t offset_to_top = get_offset_to_top(vtable);
+    return adjust_pointer(p, offset_to_top);
+  }
+
+  // We assume that -1 cannot be a valid pointer to object.
+  const void * const ambiguous_object =
+    reinterpret_cast<const void*>(-1);
+
+  // Return a pointer to the subobject described by base_info.
+
+  const void*
+  get_subobject(const void* object,
+                const void* vtable,
+                const abi::__base_class_type_info* base_info)
+  {
+    long offset = base_info->offset();
+    if (base_info->is_virtual())
+      {
+        const std::ptrdiff_t* virtual_base_offset_address =
+          static_cast<const std::ptrdiff_t*> (adjust_pointer(vtable, offset));
+        offset = *virtual_base_offset_address;
+      }
+    return adjust_pointer(object, offset);
+  }
+
+  // Helper of __dyanmic_cast to walk the type tree of an object.
+
+  const void *
+  walk_object(const void *object,
+              const abi::__class_type_info *type,
+              const void *match_object,
+              const abi::__class_type_info *match_type)
+  {
+    if (*type == *match_type)
+      return (match_object == NULL || object == match_object) ? object : NULL;
+
+    switch(type->code())
+      {
+      case abi::__class_type_info::CLASS_TYPE_INFO_CODE:
+        // This isn't not the class you're looking for.
+        return NULL;
+
+      case abi::__class_type_info::SI_CLASS_TYPE_INFO_CODE:
+        // derived type has a single public base at offset 0.
+        {
+          const abi::__si_class_type_info* ti =
+            static_cast<const abi::__si_class_type_info*>(type);
+          return walk_object(object, ti->__base_type, match_object,
+                             match_type);
+        }
+
+      case abi::__class_type_info::VMI_CLASS_TYPE_INFO_CODE:
+        {
+          const void* vtable = get_vtable(object);
+          const abi::__vmi_class_type_info* ti =
+            static_cast<const abi::__vmi_class_type_info*>(type);
+
+          // Look at all direct bases.
+          const void* result = NULL;
+          for (unsigned i = 0; i < ti->__base_count; ++i)
+            {
+              if (!ti->__base_info[i].is_public())
+                continue;
+
+              const void *subobject =
+                get_subobject(object, vtable, &ti->__base_info[i]);
+              const void* walk_subobject_result =
+                walk_object(subobject, ti->__base_info[i].__base_type,
+                            match_object, match_type);
+
+              if (walk_subobject_result == ambiguous_object)
+                return ambiguous_object;
+              else if (walk_subobject_result != NULL)
+                {
+                  if (result == NULL)
+                    {
+                      result = walk_subobject_result;
+                    }
+                  else if (result != walk_subobject_result)
+                    return ambiguous_object;
+                }
+            }
+          return result;
+        }
+
+      default:
+        assert(0);
+      }
+    return NULL;
+  }
+
+  // Bookkeeping structure for derived-to-base cast in the general case.
+  struct cast_context
+  {
+  public:
+    const void* object;
+    const abi::__class_type_info *src_type;
+    const abi::__class_type_info *dst_type;
+    std::ptrdiff_t src2dst_offset;
+
+    const void* dst_object;
+    const void* result;
+
+    cast_context(const void* obj, const abi::__class_type_info *src,
+                 const abi::__class_type_info *dst, std::ptrdiff_t offset)
+      : object(obj), src_type(src), dst_type(dst), src2dst_offset(offset),
+        dst_object(NULL), result(NULL)
+    { }
+  };
+
+  // based-to-derive cast in the general case.
+
+  void
+  base_to_derived_cast(const void *object,
+                       const abi::__class_type_info *type,
+                       cast_context* context)
+  {
+    const void* saved_dst_object = context->dst_object;
+    bool is_dst_type = *type == *context->dst_type;
+    if (is_dst_type)
+      context->dst_object = object;
+
+    if (object == context->object
+        && context->dst_object != NULL
+        && *type == *context->src_type)
+      {
+        if (context->result == NULL)
+          context->result = context->dst_object;
+        else if (context->result != context->dst_object)
+          context->result = ambiguous_object;
+        context->dst_object = saved_dst_object;
+        return;
+      }
+
+    switch(type->code())
+      {
+      case abi::__class_type_info::CLASS_TYPE_INFO_CODE:
+        // This isn't not the class you're looking for.
+        break;
+
+      case abi::__class_type_info::SI_CLASS_TYPE_INFO_CODE:
+        // derived type has a single public base at offset 0.
+        {
+          const abi::__si_class_type_info* ti =
+            static_cast<const abi::__si_class_type_info*>(type);
+          base_to_derived_cast(object, ti->__base_type, context);
+          break;
+        }
+
+      case abi::__class_type_info::VMI_CLASS_TYPE_INFO_CODE:
+        {
+          const void* vtable = get_vtable(object);
+          const abi::__vmi_class_type_info* ti =
+            static_cast<const abi::__vmi_class_type_info*>(type);
+
+          // Look at all direct bases.
+          for (unsigned i = 0; i < ti->__base_count; ++i)
+            {
+              if (!ti->__base_info[i].is_public())
+                continue;
+
+              const void *subobject =
+                get_subobject(object, vtable, &ti->__base_info[i]);
+              base_to_derived_cast(subobject, ti->__base_info[i].__base_type,
+                                   context);
+
+              // FIXME: Use flags in base_info to optimize search.
+              if (context->result == ambiguous_object)
+                break;
+            }
+          break;
+        }
+
+      default:
+        assert(0);
+      }
+     context->dst_object = saved_dst_object;
+  }
+} // namespace
+
+namespace __cxxabiv1
+{
+#define DYNAMIC_CAST_NO_HINT -1
+#define DYNAMIC_CAST_NOT_PUBLIC_BASE -2
+#define DYNAMIC_CAST_MULTIPLE_PUBLIC_NONVIRTUAL_BASE -3
+
+  /* v: source address to be adjusted; nonnull, and since the
+   *    source object is polymorphic, *(void**)v is a virtual pointer.
+   * src: static type of the source object.
+   * dst: destination type (the "T" in "dynamic_cast<T>(v)").
+   * src2dst_offset: a static hint about the location of the
+   *    source subobject with respect to the complete object;
+   *    special negative values are:
+   *       -1: no hint
+   *       -2: src is not a public base of dst
+   *       -3: src is a multiple public base type but never a
+   *           virtual base type
+   *    otherwise, the src type is a unique public nonvirtual
+   *    base type of dst at offset src2dst_offset from the
+   *    origin of dst.
+   */
+  extern "C" void*
+  __dynamic_cast (const void *v,
+                  const abi::__class_type_info *src,
+                  const abi::__class_type_info *dst,
+                  std::ptrdiff_t src2dst_offset)
+  {
+    const void* most_derived_object = get_most_derived_object(v);
+    const void* vtable = get_vtable(most_derived_object);
+    const abi::__class_type_info* most_derived_class_type_info =
+      get_class_type_info(vtable);
+
+    // If T is not a public base type of the most derived class referred
+    // by v, the cast always fails.
+    void* t_object =
+      const_cast<void*>(walk_object(most_derived_object,
+                                    most_derived_class_type_info, NULL, dst));
+    if (t_object == NULL)
+      return NULL;
+
+    // C++ ABI 2.9.7 The dynamic_cast Algorithm:
+    //
+    // If, in the most derived object pointed (referred) to by v, v points
+    // (refers) to a public base class subobject of a T object [note: this can
+    // be checked at compile time], and if only one object of type T is derived
+    // from the subobject pointed (referred) to by v, the result is a pointer
+    // (an lvalue referring) to that T object.
+
+    // We knew that src is not a public base, so base-to-derived cast
+    // is not possible.  This works even if there are multiple subobjects
+    // of type T in the most derived object.
+    if (src2dst_offset != DYNAMIC_CAST_NOT_PUBLIC_BASE)
+      {
+        // If it is known that v points to a public base class subobject
+        // of a T object, simply adjust the pointer by the offset.
+        if (t_object != ambiguous_object && src2dst_offset >= 0)
+          return const_cast<void*>(adjust_pointer(v, src2dst_offset));
+
+        // If there is only one T type subobject, we only need to look at
+        // there.  Otherwise, look for the subobject referred by v in the
+        // most derived object.
+        cast_context context(v, src, dst, src2dst_offset);
+        if (t_object != ambiguous_object)
+          base_to_derived_cast(t_object, dst, &context);
+        else
+          base_to_derived_cast(most_derived_object,
+                               most_derived_class_type_info, &context);
+
+        if (context.result != NULL && context.result != ambiguous_object)
+          return const_cast<void*>(context.result);
+      }
+
+    // C++ ABI 2.9.7 The dynamic_cast Algorithm:
+    //
+    // Otherwise, if v points (refers) to a public base class subobject of the
+    // most derived object, and the type of the most derived object has an
+    // unambiguous public base class of type T, the result is a pointer (an
+    // lvalue referring) to the T subobject of the most derived object.
+    // Otherwise, the run-time check fails.
+
+    // Check to see if T is a unambiguous public base class.
+    if (t_object == ambiguous_object)
+      return NULL;
+
+    // See if v refers to a public base class subobject.
+    const void* v_object =
+      walk_object(most_derived_object, most_derived_class_type_info, v, src);
+    return v_object == v ? t_object : NULL;
+  }
+} // namespace __cxxabiv1
diff --git a/src/enum_type_info.cc b/src/enum_type_info.cc
new file mode 100644
index 0000000..3a0f809
--- /dev/null
+++ b/src/enum_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// enum_type_info.cc: Methods for __enum_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __enum_type_info::~__enum_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/function_type_info.cc b/src/function_type_info.cc
new file mode 100644
index 0000000..138dd07
--- /dev/null
+++ b/src/function_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// function_type_info.cc: Methods for __function_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __function_type_info::~__function_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/fundamental_type_info.cc b/src/fundamental_type_info.cc
new file mode 100644
index 0000000..d84af0a
--- /dev/null
+++ b/src/fundamental_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// array_type_info.cc: Methods for __array_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __array_type_info::~__array_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/new.cc b/src/new.cc
new file mode 100644
index 0000000..77f54a4
--- /dev/null
+++ b/src/new.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+
+#include <stdlib.h>
+#include <new>
+
+// FIXME: need to handle exceptions
+void*
+operator new(std::size_t size) throw (/*std::bad_alloc*/)
+{
+  void* ptr = malloc(size);
+#if 0
+  if (ptr == NULL)
+    throw std::bad_alloc();
+#endif
+  return ptr;
+}
diff --git a/src/pbase_type_info.cc b/src/pbase_type_info.cc
new file mode 100644
index 0000000..d7b1901
--- /dev/null
+++ b/src/pbase_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// pbase_type_info.cc: Methods for __pbase_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __pbase_type_info::~__pbase_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/pointer_to_member_type_info.cc b/src/pointer_to_member_type_info.cc
new file mode 100644
index 0000000..e2892ab
--- /dev/null
+++ b/src/pointer_to_member_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// pointer_to_member_type_info.cc: Methods for __pointer_to_member_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __pointer_to_member_type_info::~__pointer_to_member_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/pointer_type_info.cc b/src/pointer_type_info.cc
new file mode 100644
index 0000000..31a84f4
--- /dev/null
+++ b/src/pointer_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// pointer_type_info.cc: Methods for __pointer_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __pointer_type_info::~__pointer_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/si_class_type_info.cc b/src/si_class_type_info.cc
new file mode 100644
index 0000000..d6a631f
--- /dev/null
+++ b/src/si_class_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// si_class_type_info.cc: Methods for __si_class_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __si_class_type_info::~__si_class_type_info()
+  {
+  }
+} // namespace __cxxabiv1
diff --git a/src/type_info.cc b/src/type_info.cc
new file mode 100644
index 0000000..69b9f3a
--- /dev/null
+++ b/src/type_info.cc
@@ -0,0 +1,75 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// type_info.cc: Methods for std::type_info.
+//
+
+#include <cxxabi.h>
+#ifdef __ARM_EABI__
+// ARM EABI requires string comprison for mangled type names for type_info
+// equality.
+#include <string.h>
+#endif
+
+#include <typeinfo>
+
+namespace std
+{
+  type_info::~type_info()
+  {
+  }
+
+  bool
+  type_info::operator==(const type_info& rhs) const
+  {
+#ifdef __ARM_EABI__
+    // IHI0041A CPPABI 3.2.5.6.  Because of weak linkage and share libraries,
+    // we perform string comparison.
+    return strcmp(this->__type_name, rhs.__type_name) == 0;
+#else
+    return this == &rhs;
+#endif
+  }
+
+  bool
+  type_info::operator!=(const type_info& rhs) const
+  {
+    return !this->operator==(rhs);
+  }
+
+  bool
+  type_info::before(const type_info& rhs) const
+  {
+#ifdef __ARM_EABI__
+    // IHI0041A CPPABI 3.2.5.6.  Because of weak linkage and share libraries,
+    // we perform string comparison.
+    return strcmp(this->__type_name, rhs.__type_name) < 0;
+#else
+    return this < &rhs;
+#endif
+  }
+} // end namespace std
diff --git a/src/vmi_class_type_info.cc b/src/vmi_class_type_info.cc
new file mode 100644
index 0000000..b6a4bf6
--- /dev/null
+++ b/src/vmi_class_type_info.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2011 The Android Open Source Project
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the project nor the names of its contributors
+//    may be used to endorse or promote products derived from this software
+//    without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+//
+// vmi_class_type_info.cc: Methods for __vmi_class_type_info.
+
+#include <cxxabi.h>
+
+namespace __cxxabiv1
+{
+  __vmi_class_type_info::~__vmi_class_type_info()
+  {
+  }
+} // namespace __cxxabiv1