summaryrefslogtreecommitdiff
path: root/src/user/lib
diff options
context:
space:
mode:
authordzwdz2022-07-26 22:40:28 +0200
committerdzwdz2022-07-26 22:40:28 +0200
commit4aee2f759ab7bf2ad9534941afef0195040ba5db (patch)
tree8799d4dac4bd82cc2274e4a8246e6891356b1511 /src/user/lib
parentd54dcb2efc4be344900a7721ac4b65b47840c5d2 (diff)
user/libc: a _start that automatically selfrelocates PIEs
Diffstat (limited to 'src/user/lib')
-rw-r--r--src/user/lib/crt0.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/user/lib/crt0.c b/src/user/lib/crt0.c
new file mode 100644
index 0000000..91bbb05
--- /dev/null
+++ b/src/user/lib/crt0.c
@@ -0,0 +1,10 @@
+#include "elfload.h"
+#include <unistd.h>
+
+int main();
+
+__attribute__((__weak__))
+void _start(void) {
+ elf_selfreloc();
+ exit(main());
+}