[Lldb-commits] [lldb] [llvm] [lldb] Fix object format of some mach-o files by using vendor info in `getDefaultFormat()` (PR #143633)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 10 17:46:39 PDT 2025


================
@@ -933,6 +933,9 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
     case Triple::Win32:
     case Triple::UEFI:
       return Triple::COFF;
+    case Triple::UnknownOS:
+      return T.getVendor() == Triple::Apple ? Triple::MachO : Triple::ELF;
+      // Intentional leak into the default case for additional logic.
     default:
       return T.isOSDarwin() ? Triple::MachO : Triple::ELF;
----------------
royitaqi wrote:

Off the top of my head: For the sake of future proof, e.g. say Apple ships their own Linux, I assume their Linux will use ELF format, and so for case where "vendor == Apple && os == Linux", we probably want to return ELF.

https://github.com/llvm/llvm-project/pull/143633


More information about the lldb-commits mailing list