From: Simon Atanasyan Date: Sat, 29 Dec 2018 10:09:55 +0000 (+0000) Subject: [mips] Show a regular error message on attempt to use one byte relocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b58d6ff0db6352eaae2fea062d3784e35d1f841;p=llvm [mips] Show a regular error message on attempt to use one byte relocation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350151 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 0e8de0577a8..7e367b755c1 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -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; diff --git a/test/MC/Mips/unsupported-relocation.s b/test/MC/Mips/unsupported-relocation.s index 151a559671f..311c0c7d60f 100644 --- a/test/MC/Mips/unsupported-relocation.s +++ b/test/MC/Mips/unsupported-relocation.s @@ -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