summaryrefslogtreecommitdiffstats
path: root/src/libc++
diff options
context:
space:
mode:
Diffstat (limited to 'src/libc++')
-rw-r--r--src/libc++/builtins.C33
-rw-r--r--src/libc++/makefile10
2 files changed, 43 insertions, 0 deletions
diff --git a/src/libc++/builtins.C b/src/libc++/builtins.C
new file mode 100644
index 000000000..ed373c8cc
--- /dev/null
+++ b/src/libc++/builtins.C
@@ -0,0 +1,33 @@
+#include <stdint.h>
+
+extern "C" int __cxa_guard_acquire(volatile uint64_t* gv)
+{
+ // 0 .. uninitialized
+ // 1 .. locked
+ // 2 .. unlocked, initialized
+ if (0 == *gv)
+ {
+ *gv = 1;
+ return 1;
+ }
+ else if (1 == *gv)
+ {
+ while(1 == *gv);
+ }
+
+ return 0;
+}
+
+extern "C" void __cxa_guard_release(volatile uint64_t* gv)
+{
+ *gv = 2;
+ return;
+}
+
+
+extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
+{
+ return 0;
+}
+
+void* __dso_handle = (void*) &__dso_handle;
diff --git a/src/libc++/makefile b/src/libc++/makefile
new file mode 100644
index 000000000..9f7cd97aa
--- /dev/null
+++ b/src/libc++/makefile
@@ -0,0 +1,10 @@
+OBJDIR = ../../obj
+include ../../config.mk
+
+OBJS = builtins.o
+OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
+
+all: ${OBJECTS}
+
+clean:
+ (rm -f ${OBJECTS} )
OpenPOWER on IntegriCloud