Merge branch 'master' of ssh://git.fedorahosted.org/git/elfutils
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index ba946c2..11e12a3 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
 2009-02-10  Ulrich Drepper  <drepper@redhat.com>
 
 	* open.c (decompress): Avoid crash with empty input file.
diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
index 9fc156f..a58d302 100644
--- a/libdwfl/dwfl_report_elf.c
+++ b/libdwfl/dwfl_report_elf.c
@@ -62,7 +62,7 @@
 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)
@@ -216,7 +216,7 @@
 	    }
 	}
 
-      if (end == 0)
+      if (end == 0 && sanity)
 	{
 	  __libdwfl_seterrno (DWFL_E_NO_PHDR);
 	  return NULL;
@@ -284,7 +284,7 @@
     }
 
   Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name,
-					   fd, elf, base);
+					   fd, elf, base, true);
   if (mod == NULL)
     {
       elf_end (elf);
diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h
index 8551949..45eac21 100644
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -306,7 +306,7 @@
    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.  */
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index e989038..30fb445 100644
--- a/libdwfl/link_map.c
+++ b/libdwfl/link_map.c
@@ -1,5 +1,5 @@
 /* Report modules by examining dynamic linker data structures.
-   Copyright (C) 2008 Red Hat, Inc.
+   Copyright (C) 2008, 2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -561,9 +561,7 @@
       void *buffer = NULL;
       size_t buffer_available = addrsize (ehdr.e_ident[EI_CLASS]);
 
-      Dwfl_Module *m;
-      int segndx = INTUSE(dwfl_addrsegment) (mod->dwfl, d_val_vaddr, &m);
-      assert (m == mod);
+      int segndx = INTUSE(dwfl_addrsegment) (mod->dwfl, d_val_vaddr, NULL);
 
       if ((*memory_callback) (mod->dwfl, segndx,
 			      &buffer, &buffer_available,
diff --git a/libdwfl/offline.c b/libdwfl/offline.c
index a80e292..34aa9f8 100644
--- a/libdwfl/offline.c
+++ b/libdwfl/offline.c
@@ -148,7 +148,7 @@
 	     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