]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
2005-08-10 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 10 Aug 2005 22:13:57 +0000 (22:13 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 10 Aug 2005 22:13:57 +0000 (22:13 +0000)
* 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.

libdwfl/ChangeLog
libdwfl/dwfl_module_getdwarf.c
libdwfl/libdwflP.h
libdwfl/relocate.c

index 6c22f8a8aa814a8c476fdd6d639180250a6412f8..532e1805d071a9be313320a627a75b1fccf364b2 100644 (file)
@@ -1,3 +1,11 @@
+2005-08-10  Roland McGrath  <roland@redhat.com>
+
+       * 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  <roland@redhat.com>
 
        * libdwflP.h: Include ../libdw/libdwP.h for its INTDECLs.
index 1583c7a8710f98a7a4a581b61df093d4f2a5ed04..cf982aafe2db2a4c8f1240e72a1b87c391af7239 100644 (file)
@@ -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;
     }
index 772bf29c5e08fd86fb0116437c4119cd4736b689..4f99386f61baeaf9ebc120b966de75c8b4644949 100644 (file)
@@ -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
index 41de6d180c9b88a3b6f838c40d36cfa5c350c2a5..48cb1ad26b2109dee0f3283fdc045128499f0f70 100644 (file)
@@ -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;