From: Eric Y. K. <eri...@gm...> - 2008-03-02 23:43:09
|
On Thu, Feb 28, 2008 at 15:49:45 +0900, shelarcy wrote: > We must tell the linker to link splited objects. > -split-objs option generates it in (OutputDir)/(ModuleName)_split directory per moudles. > You can see that your own directory or below cabal code. > > http://www.haskell.org/ghc/docs/latest/html/libraries/Cabal/src/Distribution-Simple-GHC.html#getHaskellObjects > > (OutputDir)/(ModuleName)_split directory has ld.script that describe just INPUT(...). > So, I think we must pass that per modules. I've had a look at this, and I confess that I'm pretty lost. I see that passing -split-objs to GHC causes it to create many tiny .o files per module (one per top-level function, says the manual), in addition to the one .o file for that module. The problem is that I don't really know what we do with them. The one difference I noticed (and that I pounced on) is that it is these files that get put into the libfoo.a archive files. I'm guessing that this is enough because when you pass in a whole bunch of object files as arguments to a linker, the linker is smart enough to ignore any files that are not used at all? Also, I'm guessing that the ld.script stuff is GNU-specific (we don't get them on MacOS X), and that it isn't even neccessary for GNU (it's just an alternative to having a very long list of command line arguments). Anyway, my latest patch shows how I currently understand things. I hope it's progress! > If we want to do it, to use -split-objs for spliting the single object file, > to use -f* options (I don't know this is good for wxHaskell or not), or to > use strip for Haskell program. Well, it seems like using strip is pretty simple advice, and quite helpful in that it shrank the UTF8Sampler from 8M to 4M. But I suppose -split-objs would really make the biggest difference? -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9 |