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

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 09:55:04 PDT 2025


================
@@ -58,7 +58,11 @@ static MCRegisterInfo *createRISCVMCRegisterInfo(const Triple &TT) {
 static MCAsmInfo *createRISCVMCAsmInfo(const MCRegisterInfo &MRI,
                                        const Triple &TT,
                                        const MCTargetOptions &Options) {
-  MCAsmInfo *MAI = new RISCVMCAsmInfo(TT);
+  MCAsmInfo *MAI = nullptr;
+  if (TT.isOSBinFormatELF())
+    MAI = new RISCVMCAsmInfo(TT);
+  else if (TT.isOSBinFormatMachO())
+    MAI = new RISCVMCAsmInfoDarwin();
----------------
jrtc27 wrote:

There's a null dereference here if neither is true that previously didn't exist

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


More information about the llvm-commits mailing list