Commit f13895fc authored by simonmar's avatar simonmar

[project @ 2005-01-10 11:45:19 by simonmar]

Work around problems caused by limit on the length of the command line
in ld, which shows up when building OpenGL on Windows with SplitObjs=YES.

We now pass the names of the input files to ld via a linker script.
This is (probably) only supported by GNU ld, so we now have to detect
GNU ld in the configure script (yawn) and back off to the old method
if we don't have it.
parent d27af865
......@@ -353,6 +353,26 @@ fi
AC_SUBST(LdXFlag)
])
dnl
dnl Check for GNU ld
dnl
AC_DEFUN(FPTOOLS_GNU_LD,
[AC_CACHE_CHECK([whether ld is GNU ld], fptools_cv_gnu_ld,
[
if ${LdCmd} -v | grep GNU 2>&1 >/dev/null; then
fptools_cv_gnu_ld=yes
else
fptools_cv_gnu_ld=no
fi
])
if test "$fptools_cv_gnu_ld" = yes; then
LdIsGNULd=YES
else
LdIsGNULd=NO
fi
AC_SUBST(LdIsGNULd)
])
# FP_PROG_AR
# ----------
......
......@@ -1257,6 +1257,7 @@ case $HostOS_CPP in
esac
AC_SUBST(LdCmd)
FPTOOLS_LD_X
FPTOOLS_GNU_LD
AC_CONFIG_FILES([mk/config.mk])
AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
......
......@@ -812,12 +812,17 @@ RM = rm -f
SED = @SedCmd@
SHELL = /bin/sh
LD = @LdCmd@
# Some ld's support the -x flag and some don't, so the configure
# script detects which we have and sets LdXFlag to "-x" or ""
# respectively.
LD = @LdCmd@
LD_X = @LdXFlag@
# GNU ld supports input via a linker script, which is useful to avoid
# overflowing command-line length limits.
LdIsGNULd = @LdIsGNULd@
#
# In emergency situations, REAL_SHELL is used to perform shell commands
# from within the ghc driver script, by scribbling the command line to
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment