[Pkg-haskell-maintainers] Bug#673081: binutils-gold breaks ghc linking stage

Jonathan Nieder jrnieder at gmail.com
Sun Jun 17 20:52:24 UTC 2012


(resending because I forgot to cc ghc at packages on the reassignment.
 Sorry for the noise.)
Joachim Breitner wrote:

>  ghc (7.4.1-4) unstable; urgency=low
>
>    [ Erik de Castro Lopo ]
>    * Add debian/patches/fix-PPC-right-shift-bug which fixes upstream GHC bug:
>      http://hackage.haskell.org/trac/ghc/ticket/6156 (Closes: #677591)
>    * Refresh other patches.
>    * debian/contol: Add myself to uploaders and set DM-Upload-Allowed to yes.
>
>    [ Joachim Breitner ]
>    * debian/patches/no-useless-timer: Backported from GHC 7.4.2, (Closes:
>      #677096)
>    * Make sure GHC is using ld.bfd, as it passes arguments not understood by
>      the gold linker (Closes: #673081)
>    * Use a saner priority for the runhaskell alternative. (Closes: #676970).
>      TODO for later: Consider removing the alternatives code altogether.

Thanks!

Unfortunately it's not working here:

 $ dpkg-query -W ghc
 ghc	7.4.1-4
 $ ghc test.hs 
 Linking test ...
 /usr/bin/ld: --hash-size=31: unknown option
 /usr/bin/ld: use the --help option for usage information
 collect2: error: ld returned 1 exit status

"ghc --info" doesn't list a path for "ld":

 ,("C compiler command","/usr/bin/gcc")
 ,("C compiler flags"," -fno-stack-protector  -Wl,--hash-size=31 -Wl,--reduce-memory-overheads")
 ,("ar command","/usr/bin/ar")
[...]
 ,("Gcc Linker flags","[\"-Wl,--hash-size=31\",\"-Wl,--reduce-memory-overheads\"]")
 ,("Ld Linker flags","[\"--hash-size=31\",\"--reduce-memory-overheads\"]")

The command line seems to be assembled in
libraries/Cabal/Cabal/Distribution/Simple/GHC.hs.

gcc doesn't support an -flinker=ld.bfd option yet, so the suggested
way to specify a linker is to pass -B/usr/lib/compat-ld on the command
line[1].  I don't know a good place to set this --- a hacky way might
be something like

--- >8 ---
--- i/aclocal.m4
+++ w/aclocal.m4
@@ -425,7 +425,7 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
     # Reduce memory usage when linking. See trac #5240.
     if test -n "$LdHashSize31"
     then
-        $3="$$3 -Wl,$LdHashSize31"
+        $3="$$3 -B/usr/lib/compat-ld -Wl,$LdHashSize31"
         $4="$$4     $LdHashSize31"
     fi
     if test -n "$LdReduceMemoryOverheads"
--- 8< ---

In libraries/Cabal/Cabal/Distribution/Simple/Program/Builtin.hs there
is:

  gccProgram :: Program
  gccProgram = (simpleProgram "gcc") {
      programFindVersion = findProgramVersion "-dumpversion" id
    }

  arProgram :: Program
  arProgram = simpleProgram "ar"
 
  ldProgram :: Program
  ldProgram = simpleProgram "ld"

Are the values passed to configure using --with-gcc, --with-ld, and so
on actually used?

Sorry for the bad news,
Jonathan

[1] http://gcc.gnu.org/ml/gcc/2012-01/msg00310.html





More information about the Pkg-haskell-maintainers mailing list