2009-02-10 Roland McGrath <roland@redhat.com>
+ * dwfl_report_elf.c (__libdwfl_report_elf): Take new arg SANITY.
+ If false, don't fail for NO_PHDR.
+ (dwfl_report_elf): Update caller.
+ * libdwflP.h: Update decl.
+ * offline.c (process_elf): Call it with false, so we don't refuse
+ dubiously-formed objects here.
+
* link_map.c (consider_executable): Don't assert dwfl_addrsegment
finds our module. We shouldn't crash when we confuse some guesses.
Dwfl_Module *
internal_function
__libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name,
- int fd, Elf *elf, GElf_Addr base)
+ int fd, Elf *elf, GElf_Addr base, bool sanity)
{
GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem);
if (ehdr == NULL)
}
}
- if (end == 0)
+ if (end == 0 && sanity)
{
__libdwfl_seterrno (DWFL_E_NO_PHDR);
return NULL;
}
Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name,
- fd, elf, base);
+ fd, elf, base, true);
if (mod == NULL)
{
elf_end (elf);
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)
+ Elf *elf, GElf_Addr base, bool sanity)
internal_function;
/* Meat of dwfl_report_offline. */
Elf *elf)
{
Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, fd, elf,
- dwfl->offline_next_address);
+ dwfl->offline_next_address, false);
if (mod != NULL)
{
/* If this is an ET_EXEC file with fixed addresses, the address range