aboutsummaryrefslogtreecommitdiff
path: root/04_dynld_nostd/main.c
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2021-04-21 23:41:59 +0200
committerjohannst <johannes.stoelp@gmail.com>2021-04-21 23:41:59 +0200
commit85230524414b6d27664bf77c8584bfeced6c71cb (patch)
treea407d634cbd379dbdf4451fee4abfd64aeaa5f67 /04_dynld_nostd/main.c
parent1df4dfdcdbbaef7e5b32c5c0bfadec02b3ccd6f0 (diff)
downloaddynld-85230524414b6d27664bf77c8584bfeced6c71cb.tar.gz
dynld-85230524414b6d27664bf77c8584bfeced6c71cb.zip
add support to resolve all relocations in PLT & RELA tables; add global variable as example to libgreet.so
Diffstat (limited to '04_dynld_nostd/main.c')
-rw-r--r--04_dynld_nostd/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/04_dynld_nostd/main.c b/04_dynld_nostd/main.c
index ca250ef..a787158 100644
--- a/04_dynld_nostd/main.c
+++ b/04_dynld_nostd/main.c
@@ -6,13 +6,17 @@
// API of `libgreet.so`.
extern const char* get_greet();
extern const char* get_greet2();
+extern int gCalled;
void _start() {
pfmt("Running _start() @ %s\n", __FILE__);
- // Call function from libgreet.so -> generates PLT entry.
+ // Call function from libgreet.so -> generates PLT relocations.
pfmt("get_greet() -> %s\n", get_greet());
pfmt("get_greet2() -> %s\n", get_greet2());
+ // Reference global variable from libgreet.so -> generates RELA relocation.
+ pfmt("libgreet.so called %d times\n", gCalled);
+
_exit(0);
}