X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=mk%2Ftarget.mk;h=62d3355770b5006a2a030c04af967c172a6dd6d0;hp=6dead338ea1b017c5b2b5bb417cb75604fca8076;hb=f13895fc3b7a38c909ee0d2d7c1de24381858024;hpb=d27af86534166ba4eea5d23768a1d01c431977f1 diff --git a/mk/target.mk b/mk/target.mk index 6dead33..62d3355 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -324,7 +324,23 @@ HC_SPLIT_PRE = \ $(RM) $@; if [ ! -d $(basename $@)_split ]; then mkdir $(basename $@)_split; else \ $(FIND) $(basename $@)_split -name '*.$(way_)o' -print | xargs $(RM) __rm_food; fi ifeq "$(GhcWithInterpreter)" "YES" -HC_SPLIT_POST = (cd $(basename $@)_split && $(LD) -r $(LD_X) -o ../$(notdir $@) *.$(way_)o) +ifeq "$(LdIsGNULd)" "YES" +# If ld is GNU ld, we can use a linker script to pass the names of the +# input files. This avoids problems with limits on the length of the +# ld command line, which we run into for large Haskell modules. +HC_SPLIT_POST = \ + ( cd $(basename $@)_split; \ + $(RM) ld.script; \ + touch ld.script; \ + echo "INPUT(" *.$(way_)o ")" >>ld.script; \ + $(LD) -r $(LD_X) -o ../$(notdir $@) ld.script; \ + ) +else +HC_SPLIT_POST = \ + ( cd $(basename $@)_split; \ + $(LD) -r $(LD_X) -o ../$(notdir $@) *.$(way_)o; \ + ) +endif # LdIsGNULd == YES else HC_SPLIT_POST = touch $@ endif # GhcWithInterpreter == YES