Add libc-free hello_world

This commit is contained in:
Dmitry Atamanov
2023-09-15 19:18:44 +05:00
committed by Christoffer Lerno
parent 9233305bd6
commit d129cd49a5
2 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
fn int main()
{
String msg = "Hello, C3 World!\n";
$$syscall(1, 1, (uptr)msg.ptr, msg.len); // __NR_write, STDOUT
return 0;
}
fn void _start() @export("_start")
{
int ret = main();
$$syscall(60, ret); // __NR_exit
}
module std::core::builtin;
def PanicFn = fn void(String message, String file, String function, uint line);
PanicFn panic = &default_panic;
fn void default_panic(String message, String file, String function, uint line)
{
}

View File

@@ -0,0 +1,21 @@
{
"authors": [ "Dmitry Atamanov https://github.com/data-man" ],
"version": "0.0.1 Omega",
"sources": [ "./**" ],
"targets": {
"hello_world": {
"type": "executable",
"opt": "O3",
"nolibc": true,
"nostdlib": true
},
},
"debug-info": "none",
"target": "linux-x64",
"reloc": "none",
"trap-on-wrap": false,
"soft-float": false,
"x86vec": "sse",
"cpu": "generic",
"output": "."
}