[Lldb-commits] [PATCH] D121444: [lldb] Fix platform selection on Apple Silicon (again)

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 11 12:06:56 PST 2022


JDevlieghere updated this revision to Diff 414722.
JDevlieghere added a comment.

Check the host architecture in PlatformMacOSX


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121444/new/

https://reviews.llvm.org/D121444

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp


Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -137,8 +137,6 @@
 PlatformMacOSX::GetSupportedArchitectures(const ArchSpec &host_arch) {
   std::vector<ArchSpec> result;
 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
-  // macOS for ARM64 support both native and translated x86_64 processes
-
   // When cmdline lldb is run on iOS, watchOS, etc, it is still
   // using "PlatformMacOSX".
   llvm::Triple::OSType host_os = GetHostOSType();
@@ -152,6 +150,21 @@
     result.push_back(ArchSpec("x86_64-apple-ios-macabi"));
     result.push_back(ArchSpec("arm64-apple-ios-macabi"));
     result.push_back(ArchSpec("arm64e-apple-ios-macabi"));
+
+    // On Apple Silicon, the host platform is compatible with iOS triples to
+    // support unmodified "iPhone and iPad Apps on Apple Silicon Macs". Because
+    // the binaries are identical, we must rely on the host architecture to
+    // tell them apart and mark the host platform as compatible or not.
+    if (host_arch.IsValid()) {
+      llvm::Triple host_triple = host_arch.GetTriple();
+      if (host_triple.getOS() == llvm::Triple::MacOSX) {
+        result.push_back(ArchSpec("arm64-apple-ios"));
+        result.push_back(ArchSpec("arm64e-apple-ios"));
+      }
+    } else {
+      result.push_back(ArchSpec("arm64-apple-ios"));
+      result.push_back(ArchSpec("arm64e-apple-ios"));
+    }
   }
 #else
   x86GetSupportedArchitectures(result);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121444.414722.patch
Type: text/x-patch
Size: 1626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220311/ace2d03a/attachment.bin>


More information about the lldb-commits mailing list