[PATCH] D41857: [Mips] Handle one byte unsupported relocations

Stefan Maksimovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 01:06:06 PST 2018


smaksimovic updated this revision to Diff 129402.
smaksimovic retitled this revision from "[Mips] Handle one byte illegal relocations" to "[Mips] Handle one byte unsupported relocations".
smaksimovic edited the summary of this revision.

https://reviews.llvm.org/D41857

Files:
  lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
  test/MC/Mips/unsupported-relocation.s


Index: test/MC/Mips/unsupported-relocation.s
===================================================================
--- test/MC/Mips/unsupported-relocation.s
+++ test/MC/Mips/unsupported-relocation.s
@@ -0,0 +1,13 @@
+# RUN: not llvm-mc -triple mips-unknown-linux -filetype=obj %s 2>%t
+# RUN: FileCheck %s < %t
+
+# Check that we emit an error for unsupported relocations instead of crashing.
+
+        .globl x
+
+        .data
+foo:
+        .byte   x
+        .byte   x+1
+
+# CHECK: LLVM ERROR: MIPS does not support one byte relocations
Index: lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
===================================================================
--- lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
@@ -225,6 +225,8 @@
   switch (Kind) {
   case Mips::fixup_Mips_NONE:
     return ELF::R_MIPS_NONE;
+  case FK_Data_1:
+    report_fatal_error("MIPS does not support one byte relocations");
   case Mips::fixup_Mips_16:
   case FK_Data_2:
     return IsPCRel ? ELF::R_MIPS_PC16 : ELF::R_MIPS_16;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41857.129402.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180111/2d10143a/attachment.bin>


More information about the llvm-commits mailing list