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.
// reading the file, and then we misalign oc->image on purpose so
// that the actual sections end up aligned again.
misalignment = machoGetMisalignment(f);
// 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
#else
misalignment = 0;
#endif
int pagesize, n, m;
#endif
int aligned;
int pagesize, n, m;
#endif
int aligned;
+ int misalignment = 0;
+#if darwin_HOST_OS
+ misalignment = oc->misalignment;
+#endif
+ oc->image -= misalignment;
oc->image = stgReallocBytes( oc->image,
oc->image = stgReallocBytes( oc->image,
aligned + sizeof (ppcJumpIsland) * count,
"ocAllocateJumpIslands" );
aligned + sizeof (ppcJumpIsland) * count,
"ocAllocateJumpIslands" );
+ oc->image += misalignment;
#endif /* USE_MMAP */
oc->jump_islands = (ppcJumpIsland *) (oc->image + aligned);
#endif /* USE_MMAP */
oc->jump_islands = (ppcJumpIsland *) (oc->image + aligned);