[llvm] r221047 - [JIT] Fix some more missing endian conversions in RuntimeDyld
Lang Hames
lhames at gmail.com
Sun Nov 2 16:20:41 PST 2014
This is great. Thanks Daniel!
- Lang.
On Sat, Nov 1, 2014 at 8:52 AM, Daniel Sanders <daniel.sanders at imgtec.com>
wrote:
> Author: dsanders
> Date: Sat Nov 1 10:52:31 2014
> New Revision: 221047
>
> URL: http://llvm.org/viewvc/llvm-project?rev=221047&view=rev
> Log:
> [JIT] Fix some more missing endian conversions in RuntimeDyld
>
> 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
>
> Modified:
> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
>
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=221047&r1=221046&r2=221047&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
> (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp Sat
> Nov 1 10:52:31 2014
> @@ -216,17 +216,18 @@ unsigned char *RuntimeDyldMachOCRTPBase<
>
> 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
> @@ -235,9 +236,9 @@ unsigned char *RuntimeDyldMachOCRTPBase<
> 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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141102/bcf87c36/attachment.html>
More information about the llvm-commits
mailing list