diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-07-05 23:21:22 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-07-05 23:21:22 +0000 |
commit | 47319595bdfdc0dfc8eb5f51bc8bd055a6ea0a7f (patch) | |
tree | 2ba1a4c78410fcb692dad3b6ce01ca1bf3cbb2a4 /ldso/libdl | |
parent | 9aa22cc9745be04035873b26f82adc4581e602b4 (diff) |
patch from Bernd Schmidt to abstract away initializing of relocation addresses
Diffstat (limited to 'ldso/libdl')
-rw-r--r-- | ldso/libdl/libdl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 84102d730..79b181628 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -377,7 +377,7 @@ void *dlopen(const char *libname, int flag) if (tpnt->dynamic_info[DT_INIT]) { void (*dl_elf_func) (void); - dl_elf_func = (void (*)(void)) (tpnt->loadaddr + tpnt->dynamic_info[DT_INIT]); + dl_elf_func = (void (*)(void)) DL_RELOC_ADDR(tpnt->loadaddr, tpnt->dynamic_info[DT_INIT]); if (dl_elf_func && *dl_elf_func != NULL) { _dl_if_debug_print("running ctors for library %s at '%p'\n", tpnt->libname, dl_elf_func); @@ -510,7 +510,7 @@ static int do_dlclose(void *vhandle, int need_fini) #endif if (tpnt->dynamic_info[DT_FINI]) { - dl_elf_fini = (int (*)(void)) (tpnt->loadaddr + tpnt->dynamic_info[DT_FINI]); + dl_elf_fini = (int (*)(void)) DL_RELOC_ADDR(tpnt->loadaddr, tpnt->dynamic_info[DT_FINI]); _dl_if_debug_print("running dtors for library %s at '%p'\n", tpnt->libname, dl_elf_fini); (*dl_elf_fini) (); @@ -620,7 +620,7 @@ int dlinfo(void) /* First start with a complete list of all of the loaded files. */ for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { fprintf(stderr, "\t%p %p %p %s %d %s\n", - tpnt->loadaddr, tpnt, tpnt->symbol_scope, + DL_LOADADDR_BASE(tpnt->loadaddr), tpnt, tpnt->symbol_scope, type[tpnt->libtype], tpnt->usage_count, tpnt->libname); } @@ -658,7 +658,7 @@ int dladdr(const void *__address, Dl_info * __info) tpnt = rpnt; _dl_if_debug_print("Module \"%s\" at %p\n", - tpnt->libname, tpnt->loadaddr); + tpnt->libname, DL_LOADADDR_BASE(tpnt->loadaddr)); if (DL_ADDR_IN_LOADADDR((ElfW(Addr)) __address, tpnt, pelf)) pelf = tpnt; @@ -687,7 +687,7 @@ int dladdr(const void *__address, Dl_info * __info) for (si = pelf->elf_buckets[hn]; si; si = pelf->chains[si]) { ElfW(Addr) symbol_addr; - symbol_addr = pelf->loadaddr + symtab[si].st_value; + symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value); if (symbol_addr <= (ElfW(Addr))__address && (!sf || sa < symbol_addr)) { sa = symbol_addr; sn = si; @@ -701,7 +701,7 @@ int dladdr(const void *__address, Dl_info * __info) if (sf) { __info->dli_fname = pelf->libname; - __info->dli_fbase = (void *)pelf->loadaddr; + __info->dli_fbase = (void *) DL_LOADADDR_BASE(pelf->loadaddr); __info->dli_sname = strtab + symtab[sn].st_name; __info->dli_saddr = (void *)sa; } |