summaryrefslogtreecommitdiff
path: root/libdwfl/dwfl_module_getdwarf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl/dwfl_module_getdwarf.c')
-rw-r--r--libdwfl/dwfl_module_getdwarf.c51
1 files changed, 6 insertions, 45 deletions
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index e99aa1f8..06cb4917 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -120,8 +120,9 @@ open_elf (Dwfl_Module *mod, struct dwfl_file *file)
/* Find the main ELF file for this module and open libelf on it.
When we return success, MOD->main.elf and MOD->main.bias are set up. */
-static void
-find_file (Dwfl_Module *mod)
+void
+internal_function
+__libdwfl_getelf (Dwfl_Module *mod)
{
if (mod->main.elf != NULL /* Already done. */
|| mod->elferr != DWFL_E_NOERROR) /* Cached failure. */
@@ -496,7 +497,7 @@ find_symtab (Dwfl_Module *mod)
|| mod->symerr != DWFL_E_NOERROR) /* Cached previous failure. */
return;
- find_file (mod);
+ __libdwfl_getelf (mod);
mod->symerr = mod->elferr;
if (mod->symerr != DWFL_E_NOERROR)
return;
@@ -592,7 +593,7 @@ __libdwfl_module_getebl (Dwfl_Module *mod)
{
if (mod->ebl == NULL)
{
- find_file (mod);
+ __libdwfl_getelf (mod);
if (mod->elferr != DWFL_E_NOERROR)
return mod->elferr;
@@ -660,7 +661,7 @@ find_dw (Dwfl_Module *mod)
|| mod->dwerr != DWFL_E_NOERROR) /* Cached previous failure. */
return;
- find_file (mod);
+ __libdwfl_getelf (mod);
mod->dwerr = mod->elferr;
if (mod->dwerr != DWFL_E_NOERROR)
return;
@@ -701,46 +702,6 @@ find_dw (Dwfl_Module *mod)
mod->dwerr = __libdwfl_canon_error (mod->dwerr);
}
-
-Elf *
-dwfl_module_getelf (Dwfl_Module *mod, GElf_Addr *loadbase)
-{
- if (mod == NULL)
- return NULL;
-
- find_file (mod);
- if (mod->elferr == DWFL_E_NOERROR)
- {
- if (mod->e_type == ET_REL && ! mod->main.relocated)
- {
- /* Before letting them get at the Elf handle,
- apply all the relocations we know how to. */
-
- mod->main.relocated = true;
- if (likely (__libdwfl_module_getebl (mod) == DWFL_E_NOERROR))
- {
- (void) __libdwfl_relocate (mod, mod->main.elf, false);
-
- if (mod->debug.elf == mod->main.elf)
- mod->debug.relocated = true;
- else if (mod->debug.elf != NULL && ! mod->debug.relocated)
- {
- mod->debug.relocated = true;
- (void) __libdwfl_relocate (mod, mod->debug.elf, false);
- }
- }
- }
-
- *loadbase = mod->main.bias;
- return mod->main.elf;
- }
-
- __libdwfl_seterrno (mod->elferr);
- return NULL;
-}
-INTDEF (dwfl_module_getelf)
-
-
Dwarf *
dwfl_module_getdwarf (Dwfl_Module *mod, Dwarf_Addr *bias)
{