[Lldb-commits] [lldb] r192358 - POSIX dyld: handle extra MIPS link map field

Ed Maste emaste at freebsd.org
Thu Oct 10 09:09:31 PDT 2013


Author: emaste
Date: Thu Oct 10 11:09:31 2013
New Revision: 192358

URL: http://llvm.org/viewvc/llvm-project?rev=192358&view=rev
Log:
POSIX dyld: handle extra MIPS link map field

On at least FreeBSD and NetBSD there is an extra field in the dyld link
map struct.  I've left an assert for other OSes (i.e., Linux/mips) until
it's determined if they do the same.

Modified:
    lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp?rev=192358&r1=192357&r2=192358&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp Thu Oct 10 11:09:31 2013
@@ -287,6 +287,21 @@ DYLDRendezvous::ReadSOEntryFromMemory(ll
     
     if (!(addr = ReadPointer(addr, &entry.base_addr)))
         return false;
+
+    // mips adds an extra load offset field to the link map struct on
+    // FreeBSD and NetBSD (need to validate other OSes).
+    // http://svnweb.freebsd.org/base/head/sys/sys/link_elf.h?revision=217153&view=markup#l57
+    const ArchSpec &arch = m_process->GetTarget().GetArchitecture();
+    if (arch.GetCore() == ArchSpec::eCore_mips64)
+    {
+        assert (arch.GetTriple().getOS() == llvm::Triple::FreeBSD ||
+                arch.GetTriple().getOS() == llvm::Triple::NetBSD);
+        addr_t mips_l_offs;
+        if (!(addr = ReadPointer(addr, &mips_l_offs)))
+            return false;
+        if (mips_l_offs != 0 && mips_l_offs != entry.base_addr)
+            return false;
+    }
     
     if (!(addr = ReadPointer(addr, &entry.path_addr)))
         return false;





More information about the lldb-commits mailing list