From 6a5543bb8f1f535ca49737bcd7be0cafca3b2a08 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 12 Oct 2026 23:08:48 +0200 Subject: feat: lib sea --- sysroot/usr/lib/libc/crt0.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sysroot/usr/lib/libc/crt0.c (limited to 'sysroot/usr/lib/libc/crt0.c') diff --git a/sysroot/usr/lib/libc/crt0.c b/sysroot/usr/lib/libc/crt0.c new file mode 100644 index 0000000..16c3a94 --- /dev/null +++ b/sysroot/usr/lib/libc/crt0.c @@ -0,0 +1,28 @@ +#include + +extern int main(int argc, char** argv); + +void _start(const char* arg, unsigned long arglen) +{ + static char arg_buffer[256]; + char* argv[3]; + int argc = 1; + argv[0] = ""; + + if (arglen > 0) + { + unsigned long count = arglen; + if (count > sizeof(arg_buffer) - 1) + count = sizeof(arg_buffer) - 1; + for (unsigned long i = 0; i < count; i++) + arg_buffer[i] = arg[i]; + arg_buffer[count] = 0; + argv[1] = arg_buffer; + argc = 2; + } + else + argv[1] = NULL; + + argv[argc] = NULL; + exit(main(argc, argv)); +} -- cgit v1.3