[MCJIT] Replace memcpy with readBytesUnaligned in RuntimeDyldMachOI386.
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / Targets / RuntimeDyldMachOI386.h
index 3ff784d63e8679adb80e8506e7c691947123425f..258b8476d42e2e1cd4d048fc299f4b03a6836f7a 100644 (file)
@@ -142,8 +142,7 @@ private:
     RelI->getOffset(Offset);
     uint8_t *LocalAddress = Section.Address + Offset;
     unsigned NumBytes = 1 << Size;
-    int64_t Addend = 0;
-    memcpy(&Addend, LocalAddress, NumBytes);
+    uint64_t Addend = readBytesUnaligned(LocalAddress, NumBytes);
 
     ++RelI;
     MachO::any_relocation_info RE2 =
@@ -202,8 +201,7 @@ private:
     RelI->getOffset(Offset);
     uint8_t *LocalAddress = Section.Address + Offset;
     unsigned NumBytes = 1 << Size;
-    int64_t Addend = 0;
-    memcpy(&Addend, LocalAddress, NumBytes);
+    int64_t Addend = readBytesUnaligned(LocalAddress, NumBytes);
 
     unsigned SymbolBaseAddr = MachO->getScatteredRelocationValue(RE);
     section_iterator TargetSI = getSectionByAddress(*MachO, SymbolBaseAddr);