[Lldb-commits] [lldb] r237278 - Change Linux Platform to support non-host Linux architectures

Ted Woodward ted.woodward at codeaurora.org
Wed May 13 11:52:56 PDT 2015


Author: ted
Date: Wed May 13 13:52:56 2015
New Revision: 237278

URL: http://llvm.org/viewvc/llvm-project?rev=237278&view=rev
Log:
Change Linux Platform to support non-host Linux architectures

Summary:
This was originally http://reviews.llvm.org/D8709 , but I didn't commit it correctly. 

Since then GetSupportedArchitectureAtIndex() has been changed. That change, http://reviews.llvm.org/D9511 , breaks non-x86 linux implementations, so this change goes back to the old implementation and adds remote linux support from D8709.

D8709 summary:

The Linux Platform currently will only say the Host architecture is supported. This patch retains that behavior for the Host Platform, but adds a list of architectures for the Remote Platform.


Reviewers: clayborg, flackr

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D9683

Modified:
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=237278&r1=237277&r2=237278&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Wed May 13 13:52:56 2015
@@ -501,6 +501,30 @@ PlatformLinux::GetSupportedArchitectureA
     {
         if (m_remote_platform_sp)
             return m_remote_platform_sp->GetSupportedArchitectureAtIndex(idx, arch);
+
+        llvm::Triple triple;
+        // Set the OS to linux
+        triple.setOS(llvm::Triple::Linux);
+        // Set the architecture
+        switch (idx)
+        {
+            case 0: triple.setArchName("x86_64"); break;
+            case 1: triple.setArchName("i386"); break;
+            case 2: triple.setArchName("arm"); break;
+            case 3: triple.setArchName("aarch64"); break;
+            case 4: triple.setArchName("mips64"); break;
+            case 5: triple.setArchName("hexagon"); break;
+            case 6: triple.setArchName("mips"); break;
+            default: return false;
+        }
+        // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the vendor by
+        // calling triple.SetVendorName("unknown") so that it is a "unspecified unknown".
+        // This means when someone calls triple.GetVendorName() it will return an empty string
+        // which indicates that the vendor can be set when two architectures are merged
+
+        // Now set the triple into "arch" and return true
+        arch.SetTriple(triple);
+        return true;
     }
     return false;
 }





More information about the lldb-commits mailing list