[llvm] r209536 - [RuntimeDyld] Remove relocation bounds check introduced in r208375 (MachO only).

Lang Hames lhames at gmail.com
Fri May 23 11:35:44 PDT 2014


Author: lhames
Date: Fri May 23 13:35:44 2014
New Revision: 209536

URL: http://llvm.org/viewvc/llvm-project?rev=209536&view=rev
Log:
[RuntimeDyld] Remove relocation bounds check introduced in r208375 (MachO only).

We do all of our address arithmetic in 64-bit, and operations involving
logically negative 32-bit offsets (actually represented as unsigned 64 bit ints)
often overflow into higher bits. The overflow check could be preserved by
casting to uint32 at the callsite for applyRelocationValue, but this would
eliminate the value of the check.

The right way to handle overflow in relocations is to make relocation processing
target specific, and compute the values for RelocationEntry objects in the
appropriate types (32-bit for 32-bit targets, 64-bit for 64-bit targets). This
is coming as part of the cleanup I'm working on.

This fixes another i386 regression test.

<rdar://problem/16889891>


Modified:
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h?rev=209536&r1=209535&r2=209536&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h Fri May 23 13:35:44 2014
@@ -28,16 +28,13 @@ class RuntimeDyldMachO : public RuntimeD
 private:
 
   /// Write the least significant 'Size' bytes in 'Value' out at the address
-  /// pointed to by Addr. Check for overflow.
+  /// pointed to by Addr.
   bool applyRelocationValue(uint8_t *Addr, uint64_t Value, unsigned Size) {
     for (unsigned i = 0; i < Size; ++i) {
       *Addr++ = (uint8_t)Value;
       Value >>= 8;
     }
 
-    if (Value) // Catch overflow
-      return Error("Relocation out of range.");
-
     return false;
   }
 





More information about the llvm-commits mailing list