From 68f5bad2ae4d3342324d8a09102a9a4f9e49f896 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 12 Oct 2005 02:12:34 +0000 Subject: [PATCH] [project @ 2005-10-12 02:12:34 by wolfgang] Mac OS X/Darwin PowerPC: Fix a problem introduced by the recent Darwin/x86 commit. Make the code that allocates jump islands for PowerPC aware of how we shift .o files in memory to compensate for Mach-O's lax alignment rules. --- ghc/rts/Linker.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index 93a79d2..f831c02 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1212,6 +1212,7 @@ loadObj( char *path ) // reading the file, and then we misalign oc->image on purpose so // that the actual sections end up aligned again. misalignment = machoGetMisalignment(f); + oc->misalignment = misalignment; #else misalignment = 0; #endif @@ -1428,6 +1429,10 @@ static int ocAllocateJumpIslands( ObjectCode* oc, int count, int first ) int pagesize, n, m; #endif int aligned; + int misalignment = 0; +#if darwin_HOST_OS + misalignment = oc->misalignment; +#endif if( count > 0 ) { @@ -1462,9 +1467,12 @@ static int ocAllocateJumpIslands( ObjectCode* oc, int count, int first ) } #else + oc->image -= misalignment; oc->image = stgReallocBytes( oc->image, + misalignment + aligned + sizeof (ppcJumpIsland) * count, "ocAllocateJumpIslands" ); + oc->image += misalignment; #endif /* USE_MMAP */ oc->jump_islands = (ppcJumpIsland *) (oc->image + aligned); -- 1.7.10.4