Status and future of the LLVM backend

Joachim Breitner mail at
Fri Dec 5 19:25:03 UTC 2014


Am Donnerstag, den 04.12.2014, 23:37 +0100 schrieb Joachim Breitner:
> The problem is that in order to find out which linker is used, ghc calls
> /usr/bin/gcc -Wl,-version
> without passing the options from -optl, so the -fuse-ld=gold is not used
> in this step. I’m a bit confused, because the code in getLinkerInfo'
> looks like it should be passing them... ah, but only on HEAD, not in
> 7.8... and git blame tells me that I probably want to apply this patch:
> commit e7b414a3cc0e27049f2608f5e0a00c47146cc46d
> Author: Sebastian Dröge <sebastian at>
> Date:   Tue Nov 18 12:40:20 2014 -0600

now gold is used, but if I set this in SRC_HC_OPTS, it is also passed to
the bootstrapping compiler, which does not work with gold.

So it seems I want to modify the "C compiler link flags" settings.

I tried to achieve this using

        Index: ghc-7.8.20141119/aclocal.m4
        --- ghc-7.8.20141119.orig/aclocal.m4
        +++ ghc-7.8.20141119/aclocal.m4
        @@ -553,6 +553,10 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
                 $3="$$3 -D_HPUX_SOURCE"
                 $5="$$5 -D_HPUX_SOURCE"
        +    arm*)
        +        # On arm, link using gold
        +        $3="$$3 -fuse-ld=gold"
        +        ;;
             # If gcc knows about the stack protector, turn it off.

but this made the settings reach parts of the build system where I did
not want them, and for example tips over configuring

        checking for setupterm in -ltinfo... yes
        configure: creating ./config.status
        config.status: creating terminfo.buildinfo
        configure: WARNING: unrecognized options: --with-compiler, --with-gcc
        ghc-cabal: Missing dependency on a foreign library:
        * Missing C library: tinfo
        This problem can usually be solved by installing the system package that
        provides this library (you may need the "-dev" version). If the library is
        already installed but in a non-standard location then you can use the flags
        --extra-include-dirs= and --extra-lib-dirs= to specify where it is.
because --gcc-options=-fuse-ld=gold is being passed to ./configure. Now
idea why that confuses ghc-cabal.

Unfortunately, cabal is not very verbose and does not tell me why and
how the test C program failed to compile.... but strace helps. And we
are back at

/usr/bin/ --hash-size=31: unknown option

But I’m not sure where this comes from.

So, less elegantly, I’m now trying
        @@ -487,7 +487,7 @@ AC_DEFUN([FP_SETTINGS],
        -    SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
        +    SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2 -fuse-ld=gold"


Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  Jabber: nomeata at  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the ghc-devs mailing list