[llvm] [llvm][macho] Support the LC_TARGET_TRIPLE load command (PR #210276)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 00:21:13 PDT 2026


================
@@ -0,0 +1,26 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
+--- !mach-o
+FileHeader:
+  magic:           0xFEEDFACF
+  cputype:         0x01000007
+  cpusubtype:      0x80000003
+  filetype:        0x00000002
+  ncmds:           1
+  sizeofcmds:      40
+  flags:           0x00218085
+  reserved:        0x00000000
+LoadCommands:
+  - cmd:             LC_TARGET_TRIPLE
+    cmdsize:         40
+    triple:          12
+    Content:         'arm64-apple-macos27.0.0'
+...
+
+
+CHECK: LoadCommands:
+CHECK:   - cmd:             LC_TARGET_TRIPLE
----------------
jh7370 wrote:

That's fair. Since this test isn't about load command dumping in general it's not a requirement of the test that we show there is exactly one load command (and even with the CHECK-NEXT, it doesn't enforce that, since nothing shows there are none after the one we actually check).

I don't have a strong opinion on the -NEXT suffix (adjusting the spacing would be good regardless). I gather that historically the output of FileCheck on failure is clearer for CHECK-NEXT versus plain CHECK, but I haven't looked into this myself and anyway, there have been substantial changes to the output since I heard that.

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


More information about the llvm-commits mailing list