summaryrefslogtreecommitdiff
path: root/src/user/app/testelf/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/testelf/main.c')
-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);
+}