[llvm-branch-commits] [llvm-branch] r332765 - Merging r322266:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 18 13:43:04 PDT 2018


Author: tstellar
Date: Fri May 18 13:43:04 2018
New Revision: 332765

URL: http://llvm.org/viewvc/llvm-project?rev=332765&view=rev
Log:
Merging r322266:

------------------------------------------------------------------------
r322266 | smaksimovic | 2018-01-11 02:07:47 -0800 (Thu, 11 Jan 2018) | 7 lines

[Mips] Handle one byte unsupported relocations

Fail gracefully instead of crashing upon encountering
this type of relocation.

Differential revision: https://reviews.llvm.org/D41857

------------------------------------------------------------------------

Added:
    llvm/branches/release_60/test/MC/Mips/unsupported-relocation.s
Modified:
    llvm/branches/release_60/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp

Modified: llvm/branches/release_60/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=332765&r1=332764&r2=332765&view=diff
==============================================================================
--- llvm/branches/release_60/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/branches/release_60/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Fri May 18 13:43:04 2018
@@ -225,6 +225,8 @@ unsigned MipsELFObjectWriter::getRelocTy
   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;

Added: llvm/branches/release_60/test/MC/Mips/unsupported-relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/test/MC/Mips/unsupported-relocation.s?rev=332765&view=auto
==============================================================================
--- llvm/branches/release_60/test/MC/Mips/unsupported-relocation.s (added)
+++ llvm/branches/release_60/test/MC/Mips/unsupported-relocation.s Fri May 18 13:43:04 2018
@@ -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




More information about the llvm-branch-commits mailing list