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

Stefan Maksimovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 02:09:15 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL322266: [Mips] Handle one byte unsupported relocations (authored by smaksimovic, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41857?vs=129402&id=129411#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41857

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


Index: llvm/trunk/test/MC/Mips/unsupported-relocation.s
===================================================================
--- llvm/trunk/test/MC/Mips/unsupported-relocation.s
+++ llvm/trunk/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: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
+++ llvm/trunk/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.129411.patch
Type: text/x-patch
Size: 1144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180111/880941a2/attachment.bin>


More information about the llvm-commits mailing list