aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/lib/debugging.cpp22
-rw-r--r--tools/nativize_llvm.py2
2 files changed, 23 insertions, 1 deletions
diff --git a/system/lib/debugging.cpp b/system/lib/debugging.cpp
new file mode 100644
index 00000000..ff9e0d68
--- /dev/null
+++ b/system/lib/debugging.cpp
@@ -0,0 +1,22 @@
+
+// Some stuff to patch up an emscripten-sdk build so it can be built natively (see nativize_llvm)
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern "C" {
+
+int *__errno()
+{
+ static int e = 0;
+ return &e;
+}
+
+void __assert_func(const char *file, int line, const char *assertt, const char *cond)
+{
+ printf("assert-func: %s : %d : %s : %s\n", file, line, assertt, cond);
+ abort();
+}
+
+}
+
diff --git a/tools/nativize_llvm.py b/tools/nativize_llvm.py
index a053b56c..de78dce2 100644
--- a/tools/nativize_llvm.py
+++ b/tools/nativize_llvm.py
@@ -27,5 +27,5 @@ Popen([LLVM_COMPILER, filename + '.clean.bc', '-o=' + filename + '.s']).communic
print 's => o'
Popen(['as', filename + '.s', '-o', filename + '.o']).communicate()[0]
print 'o => runnable'
-Popen(['g++', filename + '.o', '-o', filename + '.run'] + ['-l' + lib for lib in libs]).communicate()[0]
+Popen(['g++', path_from_root('system', 'lib', 'debugging.cpp'), filename + '.o', '-o', filename + '.run'] + ['-l' + lib for lib in libs]).communicate()[0]