From 36272db3cad448211389168cced4baac39a1a0d1 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 11 Sep 2018 10:09:45 +0000 Subject: Vendor import of llvm release_70 branch r341916: https://llvm.org/svn/llvm-project/llvm/branches/release_70@341916 --- lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp') diff --git a/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp b/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp index 6c255e9ef780..1822d8688fa2 100644 --- a/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp +++ b/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp @@ -10,6 +10,8 @@ #include "MCTargetDesc/BPFMCTargetDesc.h" #include "llvm/ADT/StringRef.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAssembler.h" +#include "llvm/MC/MCContext.h" #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/Support/EndianStream.h" @@ -71,7 +73,12 @@ void BPFAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, bool IsResolved, const MCSubtargetInfo *STI) const { if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) { - assert(Value == 0); + if (Value) { + MCContext &Ctx = Asm.getContext(); + Ctx.reportError(Fixup.getLoc(), + "Unsupported relocation: try to compile with -O2 or above, " + "or check your static variable usage"); + } } else if (Fixup.getKind() == FK_Data_4) { support::endian::write(&Data[Fixup.getOffset()], Value, Endian); } else if (Fixup.getKind() == FK_Data_8) { -- cgit v1.3