Translate bootstrapping main from C to LLVM IR

This avoids needing a C compiler for every platform.
This commit is contained in:
Ayke van Laethem
2018-06-03 17:32:10 +02:00
parent a9bbed2f6c
commit 588910792d
4 changed files with 53 additions and 46 deletions
-21
View File
@@ -1,21 +0,0 @@
#include "runtime.h"
#include <string.h>
void go_init() __asm__("runtime.initAll");
void go_main() __asm__("main.main");
int main() {
go_init();
go_main();
return 0;
}
__attribute__((weak))
void * memset(void *s, int c, size_t n) {
for (size_t i = 0; i < n; i++) {
((uint8_t*)s)[i] = c;
}
return s;
}
+10
View File
@@ -0,0 +1,10 @@
source_filename = "runtime/runtime.ll"
declare void @runtime.initAll()
declare void @main.main()
define i32 @main() {
call void @runtime.initAll()
call void @main.main()
ret i32 0
}