From 7da4d2b9cfa1d09991431f849d62a8a8d30f5e51 Mon Sep 17 00:00:00 2001 From: johannst Date: Mon, 26 Apr 2021 21:48:01 +0200 Subject: libgreet/main: updated comments --- 04_dynld_nostd/libgreet.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to '04_dynld_nostd/libgreet.c') diff --git a/04_dynld_nostd/libgreet.c b/04_dynld_nostd/libgreet.c index e697690..f90bdbf 100644 --- a/04_dynld_nostd/libgreet.c +++ b/04_dynld_nostd/libgreet.c @@ -5,19 +5,25 @@ int gCalled = 0; const char* get_greet() { + // Reference global variable -> generates RELA relocation (R_X86_64_GLOB_DAT). ++gCalled; return "Hello from libgreet.so!"; } const char* get_greet2() { + // Reference global variable -> generates RELA relocation (R_X86_64_GLOB_DAT). ++gCalled; return "Hello 2 from libgreet.so!"; } -__attribute__((constructor)) static void libinit() { /* static -> generates R_X86_64_RELATIVE relocation */ +// Definition of `static` function which is referenced from the `INIT` dynamic +// section entry -> generates R_X86_64_RELATIVE relocation. +__attribute__((constructor)) static void libinit() { pfmt("libgreet.so: libinit\n"); } -__attribute__((destructor)) void libfini() { /* non static -> generates R_X86_64_64 relocation */ +// Definition of `non static` function which is referenced from the `FINI` +// dynamic section entry -> generates R_X86_64_64 relocation. +__attribute__((destructor)) void libfini() { pfmt("libgreet.so: libfini\n"); } -- cgit v1.2.3