summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdwfl/ChangeLog8
-rw-r--r--libdwfl/dwfl_module_getdwarf.c2
-rw-r--r--libdwfl/libdwflP.h7
-rw-r--r--libdwfl/relocate.c18
4 files changed, 22 insertions, 13 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 6c22f8a8..532e1805 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,11 @@
+2005-08-10 Roland McGrath <[email protected]>
+
+ * relocate.c (__libdwfl_relocate): Take argument DEBUGFILE,
+ use it instead of MOD->debug.file.
+ * libdwflP.h: Update decl.
+ * dwfl_module_getdwarf.c (load_dw): Update caller.
+ Fixes bug #165598.
+
2005-08-09 Roland McGrath <[email protected]>
* libdwflP.h: Include ../libdw/libdwP.h for its INTDECLs.
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index 1583c7a8..cf982aaf 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -299,7 +299,7 @@ load_dw (Dwfl_Module *mod, Elf *debugfile)
find_symtab (mod);
Dwfl_Error result = mod->symerr;
if (result == DWFL_E_NOERROR)
- result = __libdwfl_relocate (mod);
+ result = __libdwfl_relocate (mod, debugfile);
if (result != DWFL_E_NOERROR)
return result;
}
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 772bf29c..4f99386f 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -177,11 +177,12 @@ extern void __libdwfl_module_free (Dwfl_Module *mod) internal_function;
/* Process relocations in debugging sections in an ET_REL file.
- MOD->debug.elf must be opened with ELF_C_READ_MMAP_PRIVATE or ELF_C_READ,
+ DEBUGFILE must be opened with ELF_C_READ_MMAP_PRIVATE or ELF_C_READ,
to make it possible to relocate the data in place (or ELF_C_RDWR or
ELF_C_RDWR_MMAP if you intend to modify the Elf file on disk). After
- this, dwarf_begin_elf on MOD->debug.elf will read the relocated data. */
-extern Dwfl_Error __libdwfl_relocate (Dwfl_Module *) internal_function;
+ this, dwarf_begin_elf on DEBUGFILE will read the relocated data. */
+extern Dwfl_Error __libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
+ internal_function;
/* Adjust *VALUE from section-relative to absolute.
MOD->dwfl->callbacks->section_address is called to determine the actual
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index 41de6d18..48cb1ad2 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -61,28 +61,28 @@ __libdwfl_relocate_value (Dwfl_Module *mod, size_t symshstrndx,
Dwfl_Error
internal_function_def
-__libdwfl_relocate (Dwfl_Module *mod)
+__libdwfl_relocate (Dwfl_Module *mod, Elf *debugfile)
{
assert (mod->isrel);
GElf_Ehdr ehdr_mem;
- const GElf_Ehdr *ehdr = gelf_getehdr (mod->debug.elf, &ehdr_mem);
+ const GElf_Ehdr *ehdr = gelf_getehdr (debugfile, &ehdr_mem);
if (ehdr == NULL)
return DWFL_E_LIBELF;
size_t symshstrndx, d_shstrndx;
if (elf_getshstrndx (mod->symfile->elf, &symshstrndx) < 0)
return DWFL_E_LIBELF;
- if (mod->symfile == &mod->debug)
+ if (mod->symfile->elf == debugfile)
d_shstrndx = symshstrndx;
- else if (elf_getshstrndx (mod->debug.elf, &d_shstrndx) < 0)
+ else if (elf_getshstrndx (debugfile, &d_shstrndx) < 0)
return DWFL_E_LIBELF;
/* Look at each section in the debuginfo file, and process the
relocation sections for debugging sections. */
Dwfl_Error result = DWFL_E_NO_DWARF;
Elf_Scn *scn = NULL;
- while ((scn = elf_nextscn (mod->debug.elf, scn)) != NULL)
+ while ((scn = elf_nextscn (debugfile, scn)) != NULL)
{
GElf_Shdr shdr_mem;
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
@@ -92,13 +92,13 @@ __libdwfl_relocate (Dwfl_Module *mod)
/* It's a relocation section. First, fetch the name of the
section these relocations apply to. */
- Elf_Scn *tscn = elf_getscn (mod->debug.elf, shdr->sh_info);
+ Elf_Scn *tscn = elf_getscn (debugfile, shdr->sh_info);
if (tscn == NULL)
return DWFL_E_LIBELF;
GElf_Shdr tshdr_mem;
GElf_Shdr *tshdr = gelf_getshdr (tscn, &tshdr_mem);
- const char *tname = elf_strptr (mod->debug.elf, d_shstrndx,
+ const char *tname = elf_strptr (debugfile, d_shstrndx,
tshdr->sh_name);
if (tname == NULL)
return DWFL_E_LIBELF;
@@ -225,7 +225,7 @@ __libdwfl_relocate (Dwfl_Module *mod)
else
{
/* Extract the original value and apply the reloc. */
- Elf_Data *d = gelf_xlatetom (mod->main.elf, &tmpdata, &rdata,
+ Elf_Data *d = gelf_xlatetom (debugfile, &tmpdata, &rdata,
ehdr->e_ident[EI_DATA]);
if (d == NULL)
return DWFL_E_LIBELF;
@@ -246,7 +246,7 @@ __libdwfl_relocate (Dwfl_Module *mod)
/* Now convert the relocated datum back to the target
format. This will write into rdata.d_buf, which
points into the raw section data being relocated. */
- Elf_Data *s = gelf_xlatetof (mod->main.elf, &rdata, &tmpdata,
+ Elf_Data *s = gelf_xlatetof (debugfile, &rdata, &tmpdata,
ehdr->e_ident[EI_DATA]);
if (s == NULL)
return DWFL_E_LIBELF;