[llvm] r350151 - [mips] Show a regular error message on attempt to use one byte relocation

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 29 02:09:56 PST 2018


Author: atanasyan
Date: Sat Dec 29 02:09:55 2018
New Revision: 350151

URL: http://llvm.org/viewvc/llvm-project?rev=350151&view=rev
Log:
[mips] Show a regular error message on attempt to use one byte relocation

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

Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=350151&r1=350150&r2=350151&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Sat Dec 29 02:09:55 2018
@@ -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::getRelocTy
   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;

Modified: llvm/trunk/test/MC/Mips/unsupported-relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/unsupported-relocation.s?rev=350151&r1=350150&r2=350151&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/unsupported-relocation.s (original)
+++ llvm/trunk/test/MC/Mips/unsupported-relocation.s Sat Dec 29 02:09:55 2018
@@ -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




More information about the llvm-commits mailing list