Simplify indirect rld_map for mips (rework r192408).

Just pass a Target* into ObjectFileELF::GetImageInfoAddress so that
it can do the extra dereference necessary on MIPS, instead of passing
a flag back to the caller.

Review: http://llvm-reviews.chandlerc.com/D1899
llvm-svn: 192469
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 00204e1..163e713 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Symbol/DWARFCallFrameInfo.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Host/Host.h"
 
 #include "llvm/ADT/PointerUnion.h"
@@ -515,7 +516,7 @@
 }
 
 Address
-ObjectFileELF::GetImageInfoAddress(bool &indirect)
+ObjectFileELF::GetImageInfoAddress(Target *target)
 {
     if (!ParseDynamicSymbols())
         return Address();
@@ -539,14 +540,24 @@
     {
         ELFDynamic &symbol = m_dynamic_symbols[i];
 
-        if (symbol.d_tag == DT_DEBUG || symbol.d_tag == DT_MIPS_RLD_MAP)
+        if (symbol.d_tag == DT_DEBUG)
         {
-            indirect = (symbol.d_tag == DT_MIPS_RLD_MAP);
             // Compute the offset as the number of previous entries plus the
             // size of d_tag.
             addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize();
             return Address(dynsym_section_sp, offset);
         }
+        else if (symbol.d_tag == DT_MIPS_RLD_MAP && target)
+        {
+            addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize();
+            addr_t dyn_base = dynsym_section_sp->GetLoadBaseAddress(target);
+            if (dyn_base == LLDB_INVALID_ADDRESS)
+                return Address();
+            Address addr;
+            Error error;
+            if (target->ReadPointerFromMemory(dyn_base + offset, false, error, addr))
+                return addr;
+        }
     }
 
     return Address();