From: Rafael Espindola Date: Thu, 4 Aug 2011 13:05:26 +0000 (+0000) Subject: Add an assert to check that the Addend fits the file format. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bbf9c4a14edbdbc384a452377d60bad8f6d8a78e;p=oota-llvm.git Add an assert to check that the Addend fits the file format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136868 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 78588ae9aca..18fed21afc6 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -462,6 +462,12 @@ void ELFObjectWriter::RecordRelocation(const MCAssembler &Asm, if (!hasRelocationAddend()) Addend = 0; + + if (is64Bit()) + assert(isInt<64>(Addend)); + else + assert(isInt<32>(Addend)); + ELFRelocationEntry ERE(RelocOffset, Index, Type, RelocSymbol, Addend); Relocations[Fragment->getParent()].push_back(ERE); }