aboutsummaryrefslogtreecommitdiff
path: root/04_dynld_nostd/main.c
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-04-17 23:47:17 +0200
committerjohannst <johannes.stoelp@gmail.com>2021-04-17 23:47:17 +0200
commit287f736e614a2931f57e9aabf42105e3cf3e8992 (patch)
treebfc6c69d4b09b37706a1ef9ae62dc98fe11c714f /04_dynld_nostd/main.c
parent4fa1f03150ddaa56cf58b11809182ef4ef2b6abd (diff)
downloaddynld-287f736e614a2931f57e9aabf42105e3cf3e8992.tar.gz
dynld-287f736e614a2931f57e9aabf42105e3cf3e8992.zip
04: able to map dependency & resolve reolcs and execture main program (initial commit)
Diffstat (limited to '04_dynld_nostd/main.c')
-rw-r--r--04_dynld_nostd/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/04_dynld_nostd/main.c b/04_dynld_nostd/main.c
new file mode 100644
index 0000000..ca250ef
--- /dev/null
+++ b/04_dynld_nostd/main.c
@@ -0,0 +1,18 @@
+// Copyright (c) 2020 Johannes Stoelp
+
+#include <io.h>
+#include <syscalls.h>
+
+// API of `libgreet.so`.
+extern const char* get_greet();
+extern const char* get_greet2();
+
+void _start() {
+ pfmt("Running _start() @ %s\n", __FILE__);
+
+ // Call function from libgreet.so -> generates PLT entry.
+ pfmt("get_greet() -> %s\n", get_greet());
+ pfmt("get_greet2() -> %s\n", get_greet2());
+
+ _exit(0);
+}