2010-05-20  Aurelien Jarno  <aurelien@aurel32.net>

	* sysdeps/mips/dl-machine.h (ELF_MACHINE_DEBUG_SETUP): test for
	RLD_MAP pointer before using it.

---
 ports/sysdeps/mips/dl-machine.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/ports/sysdeps/mips/dl-machine.h
+++ b/ports/sysdeps/mips/dl-machine.h
@@ -68,7 +68,8 @@
 /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
    with the run-time address of the r_debug structure  */
 #define ELF_MACHINE_DEBUG_SETUP(l,r) \
-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
+do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \
+	 (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \
        *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
        (ElfW(Addr)) (r); \
    } while (0)
