mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Add libc-free hello_world
This commit is contained in:
committed by
Christoffer Lerno
parent
9233305bd6
commit
d129cd49a5
22
resources/examples/nolibc/hello_world.c3
Normal file
22
resources/examples/nolibc/hello_world.c3
Normal 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)
|
||||
{
|
||||
}
|
||||
21
resources/examples/nolibc/project.json
Normal file
21
resources/examples/nolibc/project.json
Normal 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": "."
|
||||
}
|
||||
Reference in New Issue
Block a user