[llvm] [RISCV] Add basic Mach-O triple support. (PR #141682)

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 09:02:43 PDT 2025


================
@@ -146,6 +146,15 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
   return RM.value_or(Reloc::Static);
 }
 
+static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
+  if (TT.isOSBinFormatELF())
+    return std::make_unique<RISCVELFTargetObjectFile>();
+  else if (TT.isOSBinFormatMachO())
+    return std::make_unique<TargetLoweringObjectFileMachO>();
+  else
+    return std::unique_ptr<TargetLoweringObjectFile>();
----------------
JDevlieghere wrote:

Unless this is matching existing code style, let's eliminate the else-after-return.
```suggestion
  if (TT.isOSBinFormatELF())
    return std::make_unique<RISCVELFTargetObjectFile>();
  if (TT.isOSBinFormatMachO())
    return std::make_unique<TargetLoweringObjectFileMachO>();
  return std::unique_ptr<TargetLoweringObjectFile>();
```

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


More information about the llvm-commits mailing list