--- /dev/null
+# Acess2 C++ Library\r
+# Makefile\r
+\r
+-include ../Makefile.cfg\r
+\r
+CPPFLAGS += \r
+CFLAGS += -Wall -Werror -Wextra\r
+CXXFLAGS += -Wall -Werror -Wextra\r
+ASFLAGS +=\r
+LDFLAGS += -Map map.txt -lc\r
+\r
+OBJ = misc.o new.o guard.o cxxabi.o typeinfo.o\r
+DEPFILES := $(OBJ:%.o=%.d)\r
+BIN = libc++.so\r
+ifeq ($(ARCHDIR),native)\r
+ OBJ := $(filter-out heap.o,$(OBJ))\r
+ BIN = libc++_acess.so\r
+endif\r
+\r
+include ../Makefile.tpl\r
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * cxxabi.cc
+ * - C++ ABI Namespace
+ */
+#include <cxxabi.h>
+
+namespace __cxxabiv1 {
+
+// --- RTTI --
+// - No inheritance class
+__class_type_info::~__class_type_info()
+{
+ // nop
+}
+
+// - Single inheritance class
+__si_class_type_info::~__si_class_type_info()
+{
+
+}
+
+// - Multiple inheritance class
+__vmi_class_type_info::~__vmi_class_type_info()
+{
+
+}
+
+}; // namespace __cxxabiv1
+
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * guard.cc
+ * - One-time construction API
+ */
+#include <stdint.h>
+
+extern "C" int __cxa_guard_acquire ( int64_t *guard_object )
+{
+ // TODO: Mutex!
+ if( *guard_object )
+ return 1;
+ *guard_object = 1;
+ return 0;
+}
+
+extern "C" void __cxa_guard_release ( int64_t *guard_object )
+{
+ *guard_object = 0;
+}
+
+extern "C" void __cxa_guard_abort ( int64_t *guard_object )
+{
+ *guard_object = 0;
+ // TODO: abort
+}
+
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * cxxabi.h
+ * - C++ ABI Namespace
+ */
+#ifndef _LIBCXX__CXXABI_H_
+#define _LIBCXX__CXXABI_H_
+
+#include <typeinfo>
+
+namespace __cxxabiv1 {
+
+class __class_type_info : public std::type_info
+{
+public:
+ virtual ~__class_type_info();
+};
+
+class __si_class_type_info : public __class_type_info
+{
+public:
+ virtual ~__si_class_type_info();
+
+ const __class_type_info *__base_type;
+};
+
+struct __base_class_type_info
+{
+public:
+
+ const __class_type_info *__base_type;
+ long __offset_flags;
+
+ enum __offset_flags_masks {
+ __virtual_mask = 0x1,
+ __public_mask = 0x2,
+ __offset_shift = 8
+ };
+
+};
+
+class __vmi_class_type_info : public __class_type_info
+{
+public:
+ virtual ~__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,
+ };
+};
+
+class __pbase_type_info : public std::type_info
+{
+public:
+ 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
+ };
+};
+
+}; // namespace __cxxabiv1
+
+#endif
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * typeinfo (header)
+ * - typeid and dynamic_cast
+ */
+#ifndef _LIBCXX__TYPEINFO_
+#define _LIBCXX__TYPEINFO_
+
+namespace std {
+
+// Type information class
+class type_info
+{
+public:
+ virtual ~type_info();
+ bool operator==(const type_info &) const;
+ bool operator!=(const type_info &) const;
+ bool before(const type_info &) const;
+ const char* name() const;
+private:
+ type_info (const type_info& rhs);
+ type_info& operator= (const type_info& rhs);
+
+ // CXX ABI
+ const char *__type_name;
+};
+
+};
+
+#endif
+
+// vim: ft=cpp
+
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * misc.cc
+ * - Miscelanious functions
+ */
+#include <string.h>
+
+extern "C" int SoMain()
+{
+ // nope
+ return 0;
+}
+
+extern "C" void __cxa_pure_virtual()
+{
+ // dunno
+}
+
+extern "C" void __gxx_personality_v0()
+{
+ // TODO: Handle __gxx_personality_v0 somehow
+}
+
+
+// DSO Support
+#define MAX_ATEXIT 32
+static struct {
+ void (*destructor) (void *);
+ void *arg;
+ void *dso_handle;
+} __cxa_atexit_funcs[MAX_ATEXIT];
+static int __cxa_atexit_func_count;
+
+extern "C" int __cxa_atexit(void (*destructor) (void *), void *arg, void *dso_handle)
+{
+ if( __cxa_atexit_func_count == MAX_ATEXIT )
+ {
+ return 1;
+ }
+
+ __cxa_atexit_funcs[__cxa_atexit_func_count].destructor = destructor;
+ __cxa_atexit_funcs[__cxa_atexit_func_count].arg = arg;
+ __cxa_atexit_funcs[__cxa_atexit_func_count].dso_handle = dso_handle;
+ __cxa_atexit_func_count ++;
+ return 0;
+}
+
+extern "C" void __cxa_finalize(void *f)
+{
+ if( f == 0 )
+ {
+ for( int i = __cxa_atexit_func_count; i --; )
+ {
+ if( __cxa_atexit_funcs[i].dso_handle == f )
+ {
+ __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
+ memmove(
+ &__cxa_atexit_funcs[i],
+ &__cxa_atexit_funcs[i+1],
+ (__cxa_atexit_func_count-i)*sizeof(__cxa_atexit_funcs[0])
+ );
+ i ++;
+ __cxa_atexit_func_count --;
+ }
+ }
+ }
+ else
+ {
+ for( int i = __cxa_atexit_func_count; i --; )
+ {
+ __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
+ }
+ __cxa_atexit_func_count = 0;
+ }
+}
+
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * new.cc
+ * - new/delete
+ */
+#include <stddef.h>
+#include <stdlib.h>
+
+// === CODE ===
+void *operator new( size_t size )
+{
+ return malloc( size );
+}
+
+void *operator new[]( size_t size )
+{
+ return malloc( size );
+}
+
+void operator delete(void *ptr)
+{
+ free(ptr);
+}
+
+void operator delete[](void *ptr)
+{
+ free(ptr);
+}
+
--- /dev/null
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * typeinfo.cc
+ * - typeid and dynamic_cast
+ */
+#include <typeinfo>
+
+namespace std {
+
+type_info::~type_info()
+{
+ // nop
+}
+
+bool type_info::operator==(const type_info& other) const
+{
+ return this->__type_name == other.__type_name;
+}
+
+bool type_info::operator!=(const type_info& other) const
+{
+ return this->__type_name != other.__type_name;
+}
+
+bool type_info::before(const type_info& other) const
+{
+ return this->__type_name < other.__type_name;
+}
+
+const char *type_info::name() const
+{
+ return this->__type_name;
+}
+
+// Private
+type_info::type_info(const type_info& rhs):
+ __type_name(rhs.__type_name)
+{
+}
+type_info& type_info::operator=(const type_info& rhs)
+{
+ __type_name = rhs.__type_name;
+ return *this;
+}
+
+
+}; // namespace std
+