mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-16 04:52:16 +00:00
Fixing some host==target assumptions in RuntimeDyld
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
73df4b9f57
commit
ab950f5f33
@ -74,7 +74,9 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
|
|||||||
if (!obj)
|
if (!obj)
|
||||||
report_fatal_error("Unable to create object image from memory buffer!");
|
report_fatal_error("Unable to create object image from memory buffer!");
|
||||||
|
|
||||||
|
// Save information about our target
|
||||||
Arch = (Triple::ArchType)obj->getArch();
|
Arch = (Triple::ArchType)obj->getArch();
|
||||||
|
IsTargetLittleEndian = obj->getObjectFile()->isLittleEndian();
|
||||||
|
|
||||||
// Symbols found in this object
|
// Symbols found in this object
|
||||||
StringMap<SymbolLoc> LocalSymbols;
|
StringMap<SymbolLoc> LocalSymbols;
|
||||||
|
@ -184,6 +184,7 @@ protected:
|
|||||||
typedef std::map<RelocationValueRef, uintptr_t> StubMap;
|
typedef std::map<RelocationValueRef, uintptr_t> StubMap;
|
||||||
|
|
||||||
Triple::ArchType Arch;
|
Triple::ArchType Arch;
|
||||||
|
bool IsTargetLittleEndian;
|
||||||
|
|
||||||
inline unsigned getMaxStubSize() {
|
inline unsigned getMaxStubSize() {
|
||||||
if (Arch == Triple::aarch64)
|
if (Arch == Triple::aarch64)
|
||||||
@ -228,14 +229,14 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeInt16BE(uint8_t *Addr, uint16_t Value) {
|
void writeInt16BE(uint8_t *Addr, uint16_t Value) {
|
||||||
if (sys::IsLittleEndianHost)
|
if (IsTargetLittleEndian)
|
||||||
Value = sys::SwapByteOrder(Value);
|
Value = sys::SwapByteOrder(Value);
|
||||||
*Addr = (Value >> 8) & 0xFF;
|
*Addr = (Value >> 8) & 0xFF;
|
||||||
*(Addr+1) = Value & 0xFF;
|
*(Addr+1) = Value & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeInt32BE(uint8_t *Addr, uint32_t Value) {
|
void writeInt32BE(uint8_t *Addr, uint32_t Value) {
|
||||||
if (sys::IsLittleEndianHost)
|
if (IsTargetLittleEndian)
|
||||||
Value = sys::SwapByteOrder(Value);
|
Value = sys::SwapByteOrder(Value);
|
||||||
*Addr = (Value >> 24) & 0xFF;
|
*Addr = (Value >> 24) & 0xFF;
|
||||||
*(Addr+1) = (Value >> 16) & 0xFF;
|
*(Addr+1) = (Value >> 16) & 0xFF;
|
||||||
@ -244,7 +245,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeInt64BE(uint8_t *Addr, uint64_t Value) {
|
void writeInt64BE(uint8_t *Addr, uint64_t Value) {
|
||||||
if (sys::IsLittleEndianHost)
|
if (IsTargetLittleEndian)
|
||||||
Value = sys::SwapByteOrder(Value);
|
Value = sys::SwapByteOrder(Value);
|
||||||
*Addr = (Value >> 56) & 0xFF;
|
*Addr = (Value >> 56) & 0xFF;
|
||||||
*(Addr+1) = (Value >> 48) & 0xFF;
|
*(Addr+1) = (Value >> 48) & 0xFF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user