|
Dynamic Dynamic Loader (DDL) Project |
![]() |
||||||||
Event Tool Framework Documentation Event Tool Framework DocumentationCall Sequence of HooksThe hooks (callback functions) in the loader are called in the following sequence :1. _dl_redirect_init() This function is called once, before the "main" function is called. 2. _dl_redirect_isactive() This function is called once before the resolution of each function symbol. If this function returns 0 then no redirection takes place for that function. 3. _dl_redirect_lookup() This function is called once for each function symbol resolution. This function is called only if some non-zero value was returned by _dl_redirect_isactive() function for that symbol. 4. _dl_redirect_definition() This function is called after _dl_redirect_lookup() is called. 5. _dl_redirect_offset() This function is called after _dl_redirect_definition(). Environment VariablesWe need to set some environment variables before executing any program with our ddl. We can store these variables in a file and then source that file before executing the loader.LD_REDIRECT This is used to control whether or not the dynamic linker should be trying to access some redirection code. If this is not set, the dynamic linker behaves exactly as it normally does, without looking for or accessing any external code. If this is set, then the linker will expect to be able to call the callback functions (hooks). If this variable is set to be a NULL string, Redirection Library will not read any specification file. Otherwise it will try to read the specification file pointed by the LD_REDIRECT environmental variable. It may also contain path of the specification file. e.g.
LD_WRAP_LIB This is used to specify the path of libraries which contain wrapper functions. We can add more than one library by colon-separaters. e.g.
LD_PRELOAD This should contain the path of event dispatcher library. e.g.
LD_LIBRARY_PATH This is a colon-separated list of directories in which to search for shared libraries. e.g.
LD_WRAP_LIB This is a colon-separated list of wrapper files(.so files). It may also have path before each file. e.g.
LD_NOVERSIONS If this is set, loader will turn off any version dependent lookup of functions. This is not a loader specified environmental variable. We defined it to turn off version dependent lookup. e.g.
This environmental variable points to a file which has list of tools to be loaded. e.g.
Specification File FormatPut keyword "LINK".On next line put <orig_funcname> <orig_libname> <new_funcname> <new_libname> new_libname must be present and must have new_funcname symbol in it. new_libname can't be "main". Try "unknown" Put keyword "END_LINK" on new line. Put keyword "TABLE". On next line put <tablename> <jumptable_funcname> <table_libname> On next line put <orig_funcname> <orig_libname> table_libname must be present and must have jumptable_funcname symbol in it. Put keyword "END_TABLE" on new line. Tools file formatThis file should contains names and complete paths of the libraries of tools. The first entry should always be the master tool.e.g.
| ||||||||||