[llvm-commits] [llvm] r136868 - /llvm/trunk/lib/MC/ELFObjectWriter.cpp

Rafael Espindola rafael.espindola at gmail.com
Thu Aug 4 06:05:27 PDT 2011


Author: rafael
Date: Thu Aug  4 08:05:26 2011
New Revision: 136868

URL: http://llvm.org/viewvc/llvm-project?rev=136868&view=rev
Log:
Add an assert to check that the Addend fits the file format.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=136868&r1=136867&r2=136868&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Thu Aug  4 08:05:26 2011
@@ -462,6 +462,12 @@
 
   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);
 }





More information about the llvm-commits mailing list