mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
Translate bootstrapping main from C to LLVM IR
This avoids needing a C compiler for every platform.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user