summaryrefslogtreecommitdiff
path: root/src/user
diff options
context:
space:
mode:
authordzwdz2022-07-24 16:34:37 +0200
committerdzwdz2022-07-24 16:34:37 +0200
commit373afdda5759198b2d5123abb578e3c649103493 (patch)
treed47c9271ac37c20630ec387ef1d2d0e2c8409024 /src/user
parent9f3fdb830f61cd8c8c1f1db9d03cba1c546c1a7e (diff)
user: put the testelf in a sensible location in the tree
Diffstat (limited to 'src/user')
-rw-r--r--src/user/app/testelf/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/user/app/testelf/main.c b/src/user/app/testelf/main.c
new file mode 100644
index 0000000..a80d233
--- /dev/null
+++ b/src/user/app/testelf/main.c
@@ -0,0 +1,18 @@
+#include <shared/printf.h>
+#include <shared/syscalls.h>
+#include <user/lib/elf.h>
+#include <user/lib/elfload.h>
+#include <user/lib/stdlib.h>
+
+const char *str = "Hello!\n", *str2 = "World.\n";
+
+__attribute__((visibility("hidden")))
+extern char _image_base[];
+
+int main(void) {
+ elf_selfreloc();
+ printf("loaded at %x\n", &_image_base);
+ printf(str);
+ printf(str2);
+ _syscall_exit(0);
+}