From: wolfgang Date: Wed, 12 Oct 2005 02:12:34 +0000 (+0000) Subject: [project @ 2005-10-12 02:12:34 by wolfgang] X-Git-Tag: Initial_conversion_from_CVS_complete~180 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=68f5bad2ae4d3342324d8a09102a9a4f9e49f896;hp=ed3d72b5eaac2c139fb5923bd60006e04d3ed3a2;p=ghc-hetmet.git [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. --- 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);