[PATCH] D52903: [COFF] [X86] Don't use llvm_unreachable for unsupported relocation types
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 4 13:45:22 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343811: [COFF] [X86] Don't use llvm_unreachable for unsupported relocation types (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D52903?vs=168351&id=168365#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52903
Files:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
llvm/trunk/test/MC/COFF/unsupported-relocations.s
Index: llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
@@ -79,7 +79,8 @@
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 @@
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.");
Index: llvm/trunk/test/MC/COFF/unsupported-relocations.s
===================================================================
--- llvm/trunk/test/MC/COFF/unsupported-relocations.s
+++ llvm/trunk/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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52903.168365.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/722242d4/attachment.bin>
More information about the llvm-commits
mailing list