diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index b0d1cb41fac1c..890184db1d1ef 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -87,9 +87,10 @@ MCContext::MCContext(const Triple &TheTriple, const MCAsmInfo *mai, Env = IsMachO; break; case Triple::COFF: - if (!TheTriple.isOSWindows() && !TheTriple.isUEFI()) - report_fatal_error( - "Cannot initialize MC for non-Windows COFF object files."); + if (!TheTriple.isOSWindows() && !TheTriple.isUEFI()) { + reportFatalUsageError( + "cannot initialize MC for non-Windows COFF object files"); + } Env = IsCOFF; break; diff --git a/llvm/test/CodeGen/AArch64/unsupported-object-format-err.ll b/llvm/test/CodeGen/AArch64/unsupported-object-format-err.ll index 740bde5e43c15..0767425d12737 100644 --- a/llvm/test/CodeGen/AArch64/unsupported-object-format-err.ll +++ b/llvm/test/CodeGen/AArch64/unsupported-object-format-err.ll @@ -1,10 +1,14 @@ -; RUN: not llc -mtriple=aarch64-pc-unknown-xcoff -filetype=null %s 2>&1 | FileCheck %s -; RUN: not llc -mtriple=aarch64-pc-unknown-goff -filetype=null %s 2>&1 | FileCheck %s +; RUN: not llc -mtriple=aarch64-pc-unknown-xcoff -filetype=null %s 2>&1 | FileCheck -check-prefix=OBJFORMAT %s +; RUN: not llc -mtriple=aarch64-pc-unknown-goff -filetype=null %s 2>&1 | FileCheck -check-prefix=OBJFORMAT %s + +; RUN: not llc -mtriple=aarch64-unknown-linux-coff -filetype=null %s 2>&1 | FileCheck -check-prefix=MCINIT %s +; CHECK: LLVM ERROR: cannot initialize MC for non-Windows COFF object files ; Make sure there is no crash or assert with unexpected object ; formats. -; CHECK: LLVM ERROR: unsupported object format +; OBJFORMAT: LLVM ERROR: unsupported object format +; MCINIT: LLVM ERROR: cannot initialize MC for non-Windows COFF object files define void @foo() { ret void }