[PATCH] Switch to support::endian::read/write in X86-specific JIT and RuntimeDyld.
Alexey Samsonov
vonosmas at gmail.com
Thu Aug 21 14:43:55 PDT 2014
================
Comment at: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:264-265
@@ -262,4 +263,4 @@
case ELF::R_X86_64_64: {
- uint64_t *Target = reinterpret_cast<uint64_t *>(Section.Address + Offset);
- *Target = Value + Addend;
+ void *Target = Section.Address + Offset;
+ support::endian::write<uint64_t, support::little, 1>(Target, Value + Addend);
DEBUG(dbgs() << "Writing " << format("%p", (Value + Addend)) << " at "
----------------
Juergen Ributzka wrote:
> What about using something like this instead?
> auto *Target = reinterpret_cast<support::ulittle64_t *>(Section.Address + Offset);
> *Target = Value + Addend;
It would still be an unaligned write of ulittle_64_t, which is UB.
http://reviews.llvm.org/D5011
More information about the llvm-commits
mailing list