+2013-04-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * NEWS (Version 0.156): New.
+
2013-04-26 Mark Wielaard <mjw@redhat.com>
* configure.ac (AM_INIT_AUTOMAKE): Request parallel-tests.
+Version 0.156
+
+libdwfl: dwfl_report_elf has new parameter add_p_vaddr.
+
Version 0.155
libelf: elf*_xlatetomd now works for cross-endian ELF note data.
+2013-04-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * libdw.map (ELFUTILS_0.156): New.
+
2013-04-24 Mark Wielaard <mjw@redhat.com>
* Makefile.am: Use AM_CPPFLAGS instead of INCLUDES.
dwfl_dwarf_line;
} ELFUTILS_0.148;
+
+ELFUTILS_0.156 {
+ global:
+ # Replaced ELFUTILS_0.122 version, which has a wrapper without add_p_vaddr.
+ dwfl_report_elf;
+} ELFUTILS_0.149;
+2013-04-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwfl_report_elf.c (__libdwfl_report_elf): Add parameter add_p_vaddr.
+ Set it to true for ET_EXEC and ET_CORE. Provide alternative
+ setup of START and BIAS if !ADD_P_VADDR. Set END from BIAS, not BASE.
+ (dwfl_report_elf): Add parameter add_p_vaddr. Pass it down. Add
+ NEW_VERSION.
+ (_compat_without_add_p_vaddr_dwfl_report_elf) <SHARED>: New, with
+ COMPAT_VERSION.
+ * libdwfl.h (dwfl_report_elf): Add parameter add_p_vaddr. Describe it.
+ * libdwflP.h (__libdwfl_report_elf): Add parameter add_p_vaddr.
+ * link_map.c (report_r_debug): Use true add_p_vaddr for dwfl_report_elf.
+ * linux-kernel-modules.c (report_kernel): Use false add_p_vaddr for
+ dwfl_report_elf.
+ * offline.c (process_elf): Use true add_p_vaddr for dwfl_report_elf.
+
2013-04-27 Mark Wielaard <mjw@redhat.com>
* link_map.c: #include system.h.
Dwfl_Module *
internal_function
__libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name,
- int fd, Elf *elf, GElf_Addr base, bool sanity)
+ int fd, Elf *elf, GElf_Addr base, bool add_p_vaddr,
+ bool sanity)
{
GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem);
if (ehdr == NULL)
case ET_CORE:
/* An assigned base address is meaningless for these. */
base = 0;
+ add_p_vaddr = true;
case ET_DYN:
default:;
{
vaddr = ph->p_vaddr & -ph->p_align;
address_sync = ph->p_vaddr + ph->p_memsz;
- start = base + vaddr;
break;
}
}
- bias = base;
+ if (add_p_vaddr)
+ {
+ start = base + vaddr;
+ bias = base;
+ }
+ else
+ {
+ start = base;
+ bias = base - vaddr;
+ }
for (size_t i = phnum; i-- > 0;)
{
if (ph->p_type == PT_LOAD
&& ph->p_vaddr + ph->p_memsz > 0)
{
- end = base + (ph->p_vaddr + ph->p_memsz);
+ end = bias + (ph->p_vaddr + ph->p_memsz);
break;
}
}
}
Dwfl_Module *
-dwfl_report_elf (Dwfl *dwfl, const char *name,
- const char *file_name, int fd, GElf_Addr base)
+dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd,
+ GElf_Addr base, bool add_p_vaddr)
{
bool closefd = false;
if (fd < 0)
}
Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name,
- fd, elf, base, true);
+ fd, elf, base, add_p_vaddr, true);
if (mod == NULL)
{
elf_end (elf);
return mod;
}
INTDEF (dwfl_report_elf)
+NEW_VERSION (dwfl_report_elf, ELFUTILS_0.156)
+
+#ifdef SHARED
+Dwfl_Module *
+ _compat_without_add_p_vaddr_dwfl_report_elf (Dwfl *dwfl, const char *name,
+ const char *file_name, int fd,
+ GElf_Addr base);
+COMPAT_VERSION_NEWPROTO (dwfl_report_elf, ELFUTILS_0.122, without_add_p_vaddr)
+
+Dwfl_Module *
+_compat_without_add_p_vaddr_dwfl_report_elf (Dwfl *dwfl, const char *name,
+ const char *file_name, int fd,
+ GElf_Addr base)
+{
+ return dwfl_report_elf (dwfl, name, file_name, fd, base, true);
+}
+#endif
extern Dwfl_Module *dwfl_report_module (Dwfl *dwfl, const char *name,
Dwarf_Addr start, Dwarf_Addr end);
-/* Report a module with start and end addresses computed from the ELF
- program headers in the given file, plus BASE. For an ET_REL file,
- does a simple absolute section layout starting at BASE.
+/* Report a module to address BASE with start and end addresses computed
+ from the ELF program headers in the given file - see the table below.
FD may be -1 to open FILE_NAME. On success, FD is consumed by the
- library, and the `find_elf' callback will not be used for this module. */
+ library, and the `find_elf' callback will not be used for this module.
+ ADD_P_VADDR BASE
+ ET_EXEC ignored ignored
+ ET_DYN false absolute address where to place the file
+ true start address relative to ELF's phdr p_vaddr
+ ET_REL ignored absolute address where to place the file
+ ET_CORE ignored ignored
+ ET_DYN ELF phdr p_vaddr address can be non-zero if the shared library
+ has been prelinked by tool prelink(8). */
extern Dwfl_Module *dwfl_report_elf (Dwfl *dwfl, const char *name,
const char *file_name, int fd,
- GElf_Addr base);
+ GElf_Addr base, bool add_p_vaddr);
/* Similar, but report the module for offline use. All ET_EXEC files
being reported must be reported before any relocatable objects.
Consumes ELF on success, not on failure. */
extern Dwfl_Module *__libdwfl_report_elf (Dwfl *dwfl, const char *name,
const char *file_name, int fd,
- Elf *elf, GElf_Addr base, bool sanity)
+ Elf *elf, GElf_Addr base,
+ bool add_p_vaddr, bool sanity)
internal_function;
/* Meat of dwfl_report_offline. */
// XXX hook for sysroot
mod = INTUSE(dwfl_report_elf) (dwfl, basename (name),
- name, -1, l_addr);
+ name, -1, l_addr, true);
}
if (mod != NULL)
if (report)
{
Dwfl_Module *mod = INTUSE(dwfl_report_elf) (dwfl, KERNEL_MODNAME,
- fname, fd, 0);
+ fname, fd, 0, false);
if (mod == NULL)
result = -1;
else
Elf *elf)
{
Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, fd, elf,
- dwfl->offline_next_address, false);
+ dwfl->offline_next_address, true,
+ false);
if (mod != NULL)
{
/* If this is an ET_EXEC file with fixed addresses, the address range
+2013-04-30 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwfl-report-elf-align.c: Use false add_p_vaddr for dwfl_report_elf.
+
2013-04-29 Mark Wielaard <mjw@redhat.com>
* test-subr.sh: Don't use pushd, just cd into test-dir.
uintptr_t base = strtoull (argv[2], &endptr, 0);
assert (endptr && !*endptr);
- Dwfl_Module *mod = dwfl_report_elf (dwfl, argv[1], argv[1], -1, base);
+ Dwfl_Module *mod = dwfl_report_elf (dwfl, argv[1], argv[1], -1, base, false);
assert (mod != NULL);
uintptr_t funcaddr = strtoull (argv[3], &endptr, 0);