[Lldb-commits] [PATCH] D13288: Restrict the scope of a hack in DYLDRendezvous

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 30 06:33:13 PDT 2015


tberghammer created this revision.
tberghammer added a reviewer: labath.
tberghammer added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Restrict the scope of a hack in DYLDRendezvous

The hack is there to work around an incorrect load address reported
by the android linker on API 21 and 22 devices. This CL restricts the
hack to those android API levels.

http://reviews.llvm.org/D13288

Files:
  source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  source/Plugins/Platform/Android/PlatformAndroid.cpp
  source/Plugins/Platform/Android/PlatformAndroid.h

Index: source/Plugins/Platform/Android/PlatformAndroid.h
===================================================================
--- source/Plugins/Platform/Android/PlatformAndroid.h
+++ source/Plugins/Platform/Android/PlatformAndroid.h
@@ -76,7 +76,10 @@
         
         uint32_t
         GetSdkVersion();
-        
+
+        bool
+        GetRemoteOSVersion() override;
+
         Error
         DisconnectRemote () override;
 
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===================================================================
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -362,3 +362,12 @@
     // Download the symbolfile from the remote device
     return GetFile(symfile_platform_filespec, dst_file_spec);
 }
+
+bool
+PlatformAndroid::GetRemoteOSVersion ()
+{
+    m_major_os_version = GetSdkVersion();
+    m_minor_os_version = 0;
+    m_update_os_version = 0;
+    return m_major_os_version != 0;
+}
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
===================================================================
--- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -17,6 +17,7 @@
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 
@@ -413,10 +414,13 @@
     std::string file_path = ReadStringFromMemory(entry.path_addr);
     entry.file_spec.SetFile(file_path, false);
 
-    // On Android L (5.0, 5.1) the load address of the "/system/bin/linker" isn't filled in
+    // On Android L (API 21, 22) the load address of the "/system/bin/linker" isn't filled in
     // correctly. To get the correct load address we fetch the load address of the file from the
     // proc file system.
-    if (arch.GetTriple().getEnvironment() == llvm::Triple::Android && entry.base_addr == 0 &&
+    uint32_t os_major = 0, os_minor = 0, os_update = 0;
+    if (arch.GetTriple().getEnvironment() == llvm::Triple::Android &&
+        m_process->GetTarget().GetPlatform()->GetOSVersion(os_major, os_minor, os_update) &&
+        (os_major == 21 || os_major == 22) &&
         (file_path == "/system/bin/linker" || file_path == "/system/bin/linker64"))
     {
         lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13288.36097.patch
Type: text/x-patch
Size: 2460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150930/4289637b/attachment.bin>


More information about the lldb-commits mailing list