+2013-11-21 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ link_map: Use proper bias, not l_addr.
+ * core-file.c (dynamic_vaddr_get): Rename to ...
+ (__libdwfl_dynamic_vaddr_get): ... here, make it global,
+ internal_function.
+ (dwfl_core_file_report): Update name in the caller.
+ * libdwflP.h (__libdwfl_dynamic_vaddr_get): New declaration.
+ * link_map.c (report_r_debug): New variable elf_dynamic_vaddr. Call
+ __libdwfl_dynamic_vaddr_get for it. Remove L_ADDR FIXME comment.
+ Use ELF_DYNAMIC_VADDR instead of L_ADDR.
+
2013-11-19 Jan Kratochvil <jan.kratochvil@redhat.com>
Compatibility with older kernels such as RHEL-6.
}
}
-static bool
-dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
+bool
+internal_function
+__libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
{
size_t phnum;
if (unlikely (elf_getphdrnum (elf, &phnum) != 0))
if (module->elf == NULL)
continue;
GElf_Addr file_dynamic_vaddr;
- if (! dynamic_vaddr_get (module->elf, &file_dynamic_vaddr))
+ if (! __libdwfl_dynamic_vaddr_get (module->elf, &file_dynamic_vaddr))
continue;
Dwfl_Module *mod;
mod = __libdwfl_report_elf (dwfl, basename (module->name), module->name,
bool close_on_fail, bool archive_ok)
internal_function;
+/* Fetch PT_DYNAMIC P_VADDR from ELF and store it to *VADDRP. Return success.
+ *VADDRP is not modified if the function fails. */
+extern bool __libdwfl_dynamic_vaddr_get (Elf *elf, GElf_Addr *vaddrp)
+ internal_function;
+
/* These are working nicely for --core, but are not ready to be
exported interfaces quite yet. */
{
Elf *elf;
Dwfl_Error error = __libdw_open_file (&fd, &elf, true, false);
- if (error == DWFL_E_NOERROR)
+ GElf_Addr elf_dynamic_vaddr;
+ if (error == DWFL_E_NOERROR
+ && __libdwfl_dynamic_vaddr_get (elf, &elf_dynamic_vaddr))
{
const void *build_id_bits;
GElf_Addr build_id_elfaddr;
int build_id_len;
bool valid = true;
- /* FIXME: Bias L_ADDR should be computed from the prelink
- state in memory (when the file got loaded), not against
- the current on-disk file state as is computed below. */
-
if (__libdwfl_find_elf_build_id (NULL, elf, &build_id_bits,
&build_id_elfaddr,
&build_id_len) > 0
{
if (r_debug_info_module != NULL)
r_debug_info_module->disk_file_has_build_id = true;
- GElf_Addr build_id_vaddr = build_id_elfaddr + l_addr;
+ GElf_Addr build_id_vaddr = (build_id_elfaddr
+ - elf_dynamic_vaddr + l_ld);
+
release_buffer (0);
int segndx = INTUSE(dwfl_addrsegment) (dwfl,
build_id_vaddr,