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

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 08:36:25 PDT 2026


================
@@ -1186,6 +1189,25 @@ bool DarwinAsmParser::parseBuildVersion(StringRef Directive, SMLoc Loc) {
   return false;
 }
 
+/// parseTargetTripleDirective
+///   ::= .target_triple parseTargetTriple
+bool DarwinAsmParser::parseTargetTripleDirective(StringRef Directive,
+                                                 SMLoc Loc) {
+  StringRef TargetTriple;
+  SMLoc TargetTripleLoc = getTok().getLoc();
+  if (getParser().parseIdentifier(TargetTriple))
+    return TokError("target triple expected");
+  std::string NormalizedTriple = Triple::normalize(TargetTriple);
+  if (!Triple(NormalizedTriple).isOSDarwin())
----------------
jroelofs wrote:

Don't we intend on using this for firmwares? The `isOSDarwin()` check here is asking whether we're building for a darwin kernel, but I think what you really want is `isOSBinformatMachO()`.

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


More information about the llvm-commits mailing list