
On 1/15/07, David Kirkman
The comment above seems to be begging for a
oc->image += oc->misalignment;
statement right after the call to stgMallocBytes.
This did in fact work (patch for rts/Linker.c below). And it *was* in the 6.6 sources, so it was removed in the last few months. Putting the line back in seems to fix everything on ppc darwin: my code which uses "ghc as a library" to do a bunch of dynamic compilation and loading works again, and the test suite looks pretty much like the results from the latest linux builds (http://www.haskell.org/ghc/dist/current/logs/x86_64-unknown-linux-test-summa...) I can only get a partial darcs repository, so I can't figure out why the line was removed -- presumably to fix something that my patch will proceed to rebreak :) Cheers, -david k. The is the testsuite summary after applying the Linker.c patch, followed by the patch. Before the patch, *every* ghci test is a failure. OVERALL SUMMARY for test run started at Mon Jan 15 14:44:24 PST 2007 1606 total tests, which gave rise to 6403 test cases, of which 0 caused framework failures 1068 were skipped 5089 expected passes 67 expected failures 2 unexpected passes 177 unexpected failures Unexpected passes: barton-mangler-bug(optasm) cholewo-eval(optasm) Unexpected failures: GMapAssoc(hpc) GMapTop(hpc) TH_dataD1(normal) TH_spliceE5_prof(normal) ThreadDelay001(ghci,threaded1,threaded2) arith005(opt,hpc,optasm,threaded2) arith011(normal,opt,hpc,optasm,ghci,threaded1,threaded2) arrowrun004(normal,opt,hpc,optasm,ghci,threaded1,threaded2) break001(ghci) break004(ghci) break005(ghci) break007(ghci) break008(ghci) break010(ghci) cabal01(normal) cabal02(normal) cg047(normal) conc019(opt) conc023(threaded2) conc037(threaded2) conc056(threaded1,threaded2) conc059(threaded1) conc063(normal,opt,hpc,optasm,ghci,threaded1,threaded2) conc064(normal,opt,hpc,optasm,ghci,threaded1,threaded2) conc065(ghci) conc066(ghci) concprog001(ghci) concprog002(threaded2) driver011(normal) driver012(normal) driver013(normal) driver014(normal) driver015(normal) driver016(normal) driver017(normal) driver018(normal) driver021(normal) driver022(normal) driver023(normal) driver024(normal) driver024a(normal) driver025(normal) driver026(normal) driver027(normal) driver028(normal) driver031(normal) driver032(normal) driver033(normal) driver034(normal) driver035(normal) driver041(normal) driver042(normal) driver043(normal) driver044(normal) driver045(normal) driver051(normal) driver052(normal) driver053(normal) driver060(normal) driver061(normal) driver062.1(normal) driver062.2(normal) driver062.3(normal) driver064(normal) driver065(normal) driver066(normal) driver067(normal) driver068(normal) driver069(normal) driver070(normal) driver071(normal) driver080(normal) driver200(normal) drvfail011(normal) dynbk002(ghci) dynbk008(ghci) ffi-deriv1(normal,opt,hpc,optasm) ffi009(ghci) forkprocess01(ghci) gadt17(normal) getC(normal,opt,hpc,optasm,ghci,threaded1,threaded2) ghci008(ghci) ghciprog004(normal) ghcpkg01(normal) ghcpkg02(normal) ghcpkg03(normal) ghcpkg04(normal) maessen_hashtab(normal,opt,hpc,optasm,ghci,threaded1,threaded2) mod56(normal) newtype(opt) num012(normal,opt,hpc,optasm,ghci,threaded1,threaded2) print001(ghci) print004(ghci) print005(ghci) print006(ghci) print007(ghci) print012(ghci) print016(ghci) read040(normal,opt,hpc,optasm) rnfail028(normal) signals002(ghci) tc049(normal,opt,hpc,optasm) tc173(normal) tcfail004(normal) tcfail005(normal) tcfail072(normal) tcfail105(normal,opt,hpc,optasm) tcfail140(normal) tcfail169(normal) tcfail172(normal) tcrun032(normal,opt,hpc,optasm,ghci,threaded1,threaded2) --- Linker-old-c 2007-01-15 12:46:29.000000000 -0800 +++ Linker.c 2007-01-15 20:06:37.000000000 -0800 @@ -1324,6 +1324,7 @@ // that the actual sections end up aligned again. oc->misalignment = machoGetMisalignment(f); oc->image = stgMallocBytes(oc->fileSize + oc->misalignment, "loadObj(image)"); + oc->image += oc->misalignment; # else oc->image = stgMallocBytes(oc->fileSize, "loadObj(image)"); # endif