summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp6
-rw-r--r--llvm/test/MC/COFF/unsupported-relocations.s5
2 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
index a5e115e5ff4..2aec695b2db 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
@@ -79,7 +79,8 @@ unsigned X86WinCOFFObjectWriter::getRelocType(MCContext &Ctx,
case FK_SecRel_4:
return COFF::IMAGE_REL_AMD64_SECREL;
default:
- llvm_unreachable("unsupported relocation type");
+ Ctx.reportError(Fixup.getLoc(), "unsupported relocation type");
+ return COFF::IMAGE_REL_AMD64_ADDR32;
}
} else if (getMachine() == COFF::IMAGE_FILE_MACHINE_I386) {
switch (FixupKind) {
@@ -100,7 +101,8 @@ unsigned X86WinCOFFObjectWriter::getRelocType(MCContext &Ctx,
case FK_SecRel_4:
return COFF::IMAGE_REL_I386_SECREL;
default:
- llvm_unreachable("unsupported relocation type");
+ Ctx.reportError(Fixup.getLoc(), "unsupported relocation type");
+ return COFF::IMAGE_REL_I386_DIR32;
}
} else
llvm_unreachable("Unsupported COFF machine type.");
diff --git a/llvm/test/MC/COFF/unsupported-relocations.s b/llvm/test/MC/COFF/unsupported-relocations.s
new file mode 100644
index 00000000000..5c17b0d45ff
--- /dev/null
+++ b/llvm/test/MC/COFF/unsupported-relocations.s
@@ -0,0 +1,5 @@
+// RUN: not llvm-mc -filetype=obj -triple i386-pc-win32 %s 2>&1 | FileCheck %s
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-win32 %s 2>&1 | FileCheck %s
+// CHECK: unsupported relocation type
+ .text
+ mov $_GLOBAL_OFFSET_TABLE_, %eax
OpenPOWER on IntegriCloud