[PATCH] Switch to support::endian::read/write in X86-specific JIT and RuntimeDyld.

Lang Hames lhames at gmail.com
Wed Aug 27 15:53:19 PDT 2014


LGTM. Thanks Alexey!

================
Comment at: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:307
@@ -303,1 +306,3 @@
+    auto Target =
+        reinterpret_cast<support::ulittle32_t *>(Section.Address + Offset);
     uint64_t FinalAddress = Section.LoadAddress + Offset;
----------------
samsonov wrote:
> lhames wrote:
> > Unfortunately this isn't safe: The remaining pointer arithmetic will be carried out with the type of Placeholder being ulittle32_t*, and sizeof(ulittle32_t) != sizeof(char).
> > 
> > I think the best thing to do is leave the pointer types as they are and introduce read and write methods to RuntimeDyldELF along the same lines as the ones you added to the JIT.
> Not sure I understand this - we don't do any pointer arithmetic with Placeholder - we just do a single dereference of that pointer.
Oh right - I missed the dereference on placeholder. Sorry about that: this is all good. :)

http://reviews.llvm.org/D5011






More information about the llvm-commits mailing list