diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-10-15 20:44:55 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2013-10-15 20:44:55 +0000 |
commit | ab950f5f334d30a7b5bfb1e009846dfb0b47f61c (patch) | |
tree | 58d958cba1e0cc8d266fd6859fcdb0d92989753c /lib | |
parent | 73df4b9f5742023838ffa4eb36638a437e728193 (diff) | |
download | external_llvm-ab950f5f334d30a7b5bfb1e009846dfb0b47f61c.zip external_llvm-ab950f5f334d30a7b5bfb1e009846dfb0b47f61c.tar.gz external_llvm-ab950f5f334d30a7b5bfb1e009846dfb0b47f61c.tar.bz2 |
Fixing some host==target assumptions in RuntimeDyld
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 2 | ||||
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 1b9e0bf..f04f8c2 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -74,7 +74,9 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) { if (!obj) report_fatal_error("Unable to create object image from memory buffer!"); + // Save information about our target Arch = (Triple::ArchType)obj->getArch(); + IsTargetLittleEndian = obj->getObjectFile()->isLittleEndian(); // Symbols found in this object StringMap<SymbolLoc> LocalSymbols; diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h index 5796c7c..b5f2991 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -184,6 +184,7 @@ protected: typedef std::map<RelocationValueRef, uintptr_t> StubMap; Triple::ArchType Arch; + bool IsTargetLittleEndian; inline unsigned getMaxStubSize() { if (Arch == Triple::aarch64) @@ -228,14 +229,14 @@ protected: } void writeInt16BE(uint8_t *Addr, uint16_t Value) { - if (sys::IsLittleEndianHost) + if (IsTargetLittleEndian) Value = sys::SwapByteOrder(Value); *Addr = (Value >> 8) & 0xFF; *(Addr+1) = Value & 0xFF; } void writeInt32BE(uint8_t *Addr, uint32_t Value) { - if (sys::IsLittleEndianHost) + if (IsTargetLittleEndian) Value = sys::SwapByteOrder(Value); *Addr = (Value >> 24) & 0xFF; *(Addr+1) = (Value >> 16) & 0xFF; @@ -244,7 +245,7 @@ protected: } void writeInt64BE(uint8_t *Addr, uint64_t Value) { - if (sys::IsLittleEndianHost) + if (IsTargetLittleEndian) Value = sys::SwapByteOrder(Value); *Addr = (Value >> 56) & 0xFF; *(Addr+1) = (Value >> 48) & 0xFF; |