Skip to content

Commit 16798ee

Browse files
authored
MC: Use reportFatalUsageError for COFF with non-windows (llvm#147911)
1 parent 5ba458c commit 16798ee

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

llvm/lib/MC/MCContext.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ MCContext::MCContext(const Triple &TheTriple, const MCAsmInfo *mai,
8787
Env = IsMachO;
8888
break;
8989
case Triple::COFF:
90-
if (!TheTriple.isOSWindows() && !TheTriple.isUEFI())
91-
report_fatal_error(
92-
"Cannot initialize MC for non-Windows COFF object files.");
90+
if (!TheTriple.isOSWindows() && !TheTriple.isUEFI()) {
91+
reportFatalUsageError(
92+
"cannot initialize MC for non-Windows COFF object files");
93+
}
9394

9495
Env = IsCOFF;
9596
break;
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
; RUN: not llc -mtriple=aarch64-pc-unknown-xcoff -filetype=null %s 2>&1 | FileCheck %s
2-
; RUN: not llc -mtriple=aarch64-pc-unknown-goff -filetype=null %s 2>&1 | FileCheck %s
1+
; RUN: not llc -mtriple=aarch64-pc-unknown-xcoff -filetype=null %s 2>&1 | FileCheck -check-prefix=OBJFORMAT %s
2+
; RUN: not llc -mtriple=aarch64-pc-unknown-goff -filetype=null %s 2>&1 | FileCheck -check-prefix=OBJFORMAT %s
3+
4+
; RUN: not llc -mtriple=aarch64-unknown-linux-coff -filetype=null %s 2>&1 | FileCheck -check-prefix=MCINIT %s
5+
; CHECK: LLVM ERROR: cannot initialize MC for non-Windows COFF object files
36

47
; Make sure there is no crash or assert with unexpected object
58
; formats.
69

7-
; CHECK: LLVM ERROR: unsupported object format
10+
; OBJFORMAT: LLVM ERROR: unsupported object format
11+
; MCINIT: LLVM ERROR: cannot initialize MC for non-Windows COFF object files
812
define void @foo() {
913
ret void
1014
}

0 commit comments

Comments
 (0)