summaryrefslogtreecommitdiff
path: root/LibC/crt0.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-22 09:21:54 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-22 09:21:54 +0100
commit42342d2337a827f8d61ff2e6b47367f6a2cbd540 (patch)
tree30215c05b1f38f7c0458ac1644060cb391447656 /LibC/crt0.cpp
parent1da261eeb6491fcda461102f4ef16534c07bbfa1 (diff)
downloadserenity-42342d2337a827f8d61ff2e6b47367f6a2cbd540.zip
LibC: Tidy up _start a bit and rename compilation unit to "crt0"
Diffstat (limited to 'LibC/crt0.cpp')
-rw-r--r--LibC/crt0.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/LibC/crt0.cpp b/LibC/crt0.cpp
new file mode 100644
index 0000000000..ab6a3ebfe2
--- /dev/null
+++ b/LibC/crt0.cpp
@@ -0,0 +1,38 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+extern "C" {
+
+int main(int, char**);
+
+int errno;
+char** environ;
+
+void __malloc_init();
+void __stdio_init();
+
+int _start(int argc, char** argv, char** env)
+{
+ errno = 0;
+ environ = env;
+
+ __stdio_init();
+ __malloc_init();
+
+ int status = main(argc, argv);
+
+ fflush(stdout);
+ fflush(stderr);
+
+ exit(status);
+
+ return 20150614;
+}
+
+[[noreturn]] void __cxa_pure_virtual()
+{
+ assert(false);
+}
+
+}