diff options
author | johannst <stoelp@eit.uni-kl.de> | 2019-06-20 21:09:39 +0200 |
---|---|---|
committer | johannst <stoelp@eit.uni-kl.de> | 2019-06-20 21:09:39 +0200 |
commit | 257763be0ffc9fa42aa91a7c4e6d202ea55be5bc (patch) | |
tree | a989c7a5c5fafb842095e9328376f11f55e20ff8 /runtime-ld.txt | |
parent | 359e0584b361f4c9b35ba3acd6d5d78f3d67587e (diff) | |
download | notes-257763be0ffc9fa42aa91a7c4e6d202ea55be5bc.tar.gz notes-257763be0ffc9fa42aa91a7c4e6d202ea55be5bc.zip |
added explore-elf and runtime-ld
Diffstat (limited to 'runtime-ld.txt')
-rw-r--r-- | runtime-ld.txt | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/runtime-ld.txt b/runtime-ld.txt new file mode 100644 index 0000000..86fe9ad --- /dev/null +++ b/runtime-ld.txt @@ -0,0 +1,62 @@ +.:: Runtime ld ::. +-------------------------------------------------------------------------------- + +# toc +------ + |ld_so| + |load_init_order| + +# ld.so(8) *ld_so* +=========== + env: + LD_PRELOAD=<l_so> colon separated list of libso's to be pre loaded + LD_DEBUG=<opts> comman separated list of debug options + =help list available options + =libs show library search path + =files processing of input files + =symbols show search path for symbol lookup + =bindings show against which definition a symbol is bound + + + ## LD_PRELOAD load & init order *load_init_order* + > ldd ./main + >> libc.so.6 => /usr/lib/libc.so.6 + + > LD_PRELOAD=liba.so:libb.so ./main + --> + preloaded in this order + <-- + initialized in this order + + - preload order determines the order libs are inserted into the link map + + - resulting link map: + +------+ +------+ +------+ +------+ + | main | -> | liba | -> | libb | -> | libc | + +------+ +------+ +------+ +------+ + + - see preload and init order in action + > LD_DEBUG=files LD_PRELOAD=liba.so:libb.so ./main + # load order (-> determines link map) + >> file=liba.so [0]; generating link map + >> file=libb.so [0]; generating link map + >> file=libc.so.6 [0]; generating link map + + # init order + >> calling init: /usr/lib/libc.so.6 + >> calling init: <path>/libb.so + >> calling init: <path>/liba.so + >> initialize program: ./main + + - see the symbol lookup in action and therefore the link map order + > LD_DEBUG=symbols,bindings LD_PRELOAD=liba.so:libb.so ./main + >> symbol=memcpy; lookup in file=./main [0] + >> symbol=memcpy; lookup in file=<path>/liba.so [0] + >> symbol=memcpy; lookup in file=<path>/libb.so [0] + >> symbol=memcpy; lookup in file=/usr/lib/libc.so.6 [0] + >> binding file ./main [0] to /usr/lib/libc.so.6 [0]: normal symbol + `memcpy' [GLIBC_2.14] + +-------------------------------------------------------------------------------- +vim:sts=2:et:tw=80:cc=80:fo+=t:ft=help + |