https://sourceware.org/bugzilla/show_bug.cgi?id=22136

--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> ---
This fixed the ld.so crash on debug file:

diff --git a/elf/dl-load.c b/elf/dl-load.c
index a067760cc6..261ec997c8 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1052,8 +1052,11 @@ _dl_map_object_from_fd (const char *name, const char
*origname, int fd,
        segments are mapped in.  We record the addresses it says
        verbatim, and later correct for the run-time load address.  */
   case PT_DYNAMIC:
-    l->l_ld = (void *) ph->p_vaddr;
-    l->l_ldnum = ph->p_memsz / sizeof (ElfW(Dyn));
+    if (ph->p_filesz)
+      {
+        l->l_ld = (void *) ph->p_vaddr;
+        l->l_ldnum = ph->p_memsz / sizeof (ElfW(Dyn));
+      }
     break;

   case PT_PHDR:

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to