aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-25 15:49:31 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-25 15:49:31 -0800
commit8d4226c06c843225f7ba7ff896fd21d16c614d06 (patch)
treecdf15e8609935039abebcc249bf9186ae2a54314
parent19a0d39383dd491f174f7d98623b7aec2547e889 (diff)
improve nativize_llvm
-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]