Skip to content

Commit

Permalink
[JIT] Fix some more missing endian conversions in RuntimeDyld
Browse files Browse the repository at this point in the history
Summary: This fixes MachO_i386_eh_frame.s on a big-endian Mips host.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6019

llvm-svn: 221047
  • Loading branch information
dsandersllvm committed Nov 1, 2014
1 parent 792e3ca commit 523b171
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
Expand Up @@ -216,17 +216,18 @@ unsigned char *RuntimeDyldMachOCRTPBase<Impl>::processFDE(unsigned char *P,

DEBUG(dbgs() << "Processing FDE: Delta for text: " << DeltaForText
<< ", Delta for EH: " << DeltaForEH << "\n");
uint32_t Length = *((uint32_t *)P);
uint32_t Length = readBytesUnaligned(P, 4);
P += 4;
unsigned char *Ret = P + Length;
uint32_t Offset = *((uint32_t *)P);
uint32_t Offset = readBytesUnaligned(P, 4);
if (Offset == 0) // is a CIE
return Ret;

P += 4;
TargetPtrT FDELocation = *((TargetPtrT*)P);
TargetPtrT FDELocation = readBytesUnaligned(P, sizeof(TargetPtrT));
TargetPtrT NewLocation = FDELocation - DeltaForText;
*((TargetPtrT*)P) = NewLocation;
writeBytesUnaligned(NewLocation, P, sizeof(TargetPtrT));

P += sizeof(TargetPtrT);

// Skip the FDE address range
Expand All @@ -235,9 +236,9 @@ unsigned char *RuntimeDyldMachOCRTPBase<Impl>::processFDE(unsigned char *P,
uint8_t Augmentationsize = *P;
P += 1;
if (Augmentationsize != 0) {
TargetPtrT LSDA = *((TargetPtrT *)P);
TargetPtrT LSDA = readBytesUnaligned(P, sizeof(TargetPtrT));
TargetPtrT NewLSDA = LSDA - DeltaForEH;
*((TargetPtrT *)P) = NewLSDA;
writeBytesUnaligned(NewLSDA, P, sizeof(TargetPtrT));
}

return Ret;
Expand Down

0 comments on commit 523b171

Please sign in to comment.