]> granicus.if.org Git - llvm/commitdiff
[mips] Show a regular error message on attempt to use one byte relocation
authorSimon Atanasyan <simon@atanasyan.com>
Sat, 29 Dec 2018 10:09:55 +0000 (10:09 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Sat, 29 Dec 2018 10:09:55 +0000 (10:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350151 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 0e8de0577a8a93361be17187cfb0cfaf5f410ae7..7e367b755c1402f5476e3c4c2d3bf46b085fa785 100644 (file)
@@ -11,6 +11,7 @@
 #include "MCTargetDesc/MipsMCTargetDesc.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/BinaryFormat/ELF.h"
+#include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCELFObjectWriter.h"
 #include "llvm/MC/MCFixup.h"
 #include "llvm/MC/MCObjectWriter.h"
@@ -225,7 +226,9 @@ unsigned MipsELFObjectWriter::getRelocType(MCContext &Ctx,
   case Mips::fixup_Mips_NONE:
     return ELF::R_MIPS_NONE;
   case FK_Data_1:
-    report_fatal_error("MIPS does not support one byte relocations");
+    Ctx.reportError(Fixup.getLoc(),
+                    "MIPS does not support one byte relocations");
+    return ELF::R_MIPS_NONE;
   case Mips::fixup_Mips_16:
   case FK_Data_2:
     return IsPCRel ? ELF::R_MIPS_PC16 : ELF::R_MIPS_16;
index 151a559671fbadda983b6305fa2546a93dae0d26..311c0c7d60f20b0ae46d49d88dd91405124fcaf6 100644 (file)
@@ -1,5 +1,5 @@
-# RUN: not llvm-mc -triple mips-unknown-linux -filetype=obj %s 2>%t
-# RUN: FileCheck %s < %t
+# RUN: not llvm-mc -triple mips-unknown-linux -filetype=obj -o %t %s 2>&1 \
+# RUN:  |  FileCheck %s
 
 # Check that we emit an error for unsupported relocations instead of crashing.
 
@@ -8,6 +8,6 @@
         .data
 foo:
         .byte   x
+# CHECK: :[[@LINE-1]]:17: error: MIPS does not support one byte relocations
         .byte   x+1
-
-# CHECK: LLVM ERROR: MIPS does not support one byte relocations
+# CHECK: :[[@LINE-1]]:17: error: MIPS does not support one byte relocations