
On 19/12/2013 03:00, Mikhail Glushenkov wrote:
The problem in https://github.com/haskell/cabal/issues/1611 is with that we have a module (say, A) from which we're only importing a single value, and this module is a part of the cabal-install source tree. It would be nice if the whole contents of A weren't linked with the final executable. So I tried to compile cabal-install with --split-objs, but apparently this doesn't work because in this case the linker's input is A.o instead of A_split_0.o A_split_1.o ... A_split_N.o. And apparently that's why the documentation says that "--split-objs doesn't make sense for executables".
Note that if cabal-install was split into an executable and a library, then this would work.
So the question is why --split-objs only works for libraries and whether this behaviour can be fixed.
There is nothing fundamental about -split-objs that prevents it from working with executables. I expect that GHC doesn't take it into account during its link step when linking an executable with -split-objs, though. That would be a reasonable enhancement - open a ticket? Cheers, Simon