I'll note this patch causes ./configure to fail when using the gold
linker on Linux systems, as it doesn't understand these options, so if
it's your default (i.e. you installed `binutils-gold`) you'll need to
update your alternatives or merely remove the package.

The trac ticket (#5204) notes that this needs to be a careful change
that only affects GNU ld. I haven't tested a Mac OS X x86_64 build
recently, but I speculate it'll probably also fail there too, since ld
on OS X doesn't understand --hash-size etc. it seems.

Can anyone confirm?

On Sat, Nov 26, 2011 at 6:55 PM, Ian Lynagh <[email protected]> wrote:
> Repository : ssh://darcs.haskell.org//srv/darcs/ghc
>
> On branch  : master
>
> http://hackage.haskell.org/trac/ghc/changeset/3275b7bd2a803a3adc0b952b6fbfeb738fc15a74
>
>>---------------------------------------------------------------
>
> commit 3275b7bd2a803a3adc0b952b6fbfeb738fc15a74
> Author: Ian Lynagh <[email protected]>
> Date:   Sun Nov 27 00:20:59 2011 +0000
>
>    Pass "--hash-size=31 --reduce-memory-overhead" to ld; fixes trac #5240
>
>    These reduce the amount of memory that ld takes when linking.
>
>>---------------------------------------------------------------
>
>  aclocal.m4                 |    9 +++++++--
>  rules/build-package-way.mk |    2 +-
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/aclocal.m4 b/aclocal.m4
> index 2bba7b7..f6f1f2b 100644
> --- a/aclocal.m4
> +++ b/aclocal.m4
> @@ -354,14 +354,14 @@ AC_DEFUN([FP_SETTINGS],
>     if test "$windows" = YES
>     then
>         SettingsCCompilerCommand='$topdir/../mingw/bin/gcc.exe'
> -        SettingsCCompilerFlags=''
> +        SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2 
> $CONF_GCC_LINKER_OPTS_STAGE2"
>         SettingsPerlCommand='$topdir/../perl/perl.exe'
>         SettingsDllWrapCommand='$topdir/../mingw/bin/dllwrap.exe'
>         SettingsWindresCommand='$topdir/../mingw/bin/windres.exe'
>         SettingsTouchCommand='$topdir/touchy.exe'
>     else
>         SettingsCCompilerCommand="$WhatGccIsCalled"
> -        SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
> +        SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2 
> $CONF_GCC_LINKER_OPTS_STAGE2"
>         SettingsPerlCommand="$PerlCmd"
>         SettingsDllWrapCommand="/bin/false"
>         SettingsWindresCommand="/bin/false"
> @@ -424,6 +424,11 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
>     then
>         $2="$$2 -fno-stack-protector"
>     fi
> +
> +    # Reduce memory usage when linking. See trac #5240.
> +    $3="$$3 -Wl,--hash-size=31 -Wl,--reduce-memory-overheads"
> +    $4="$$4     --hash-size=31     --reduce-memory-overheads"
> +
>     rm -f conftest.c conftest.o
>     AC_MSG_RESULT([done])
>  ])
> diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
> index 00ce065..de1b713 100644
> --- a/rules/build-package-way.mk
> +++ b/rules/build-package-way.mk
> @@ -114,7 +114,7 @@ BINDIST_LIBS += $$($1_$2_GHCI_LIB)
>  endif
>  endif
>  $$($1_$2_GHCI_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) 
> $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
> -       "$$(LD)" -r -o $$@ $$(EXTRA_LD_OPTS) $$($1_$2_$3_HS_OBJS) 
> $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) 
> $$($1_$2_EXTRA_OBJS)
> +       "$$(LD)" $$(CONF_LD_LINKER_OPTS_STAGE$4) -r -o $$@ $$(EXTRA_LD_OPTS) 
> $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) 
> $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
>
>  ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES"
>  # Don't bother making ghci libs for bootstrapping packages
>
>
>
> _______________________________________________
> Cvs-ghc mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/cvs-ghc
>



-- 
Regards,
Austin

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to