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

Joachim Breitner nomeata at debian.org
Sun Jun 17 21:35:14 UTC 2012


Hi,

Am Sonntag, den 17.06.2012, 15:52 -0500 schrieb Jonathan Nieder:
> (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?

yes, I also noticed that it’s not actually calling ld, but rather gcc,
after building and uploading ghc.

I’m not quite happy with adding a hack deep inside automake files. As
the configure script is testing the binary that has been passed with
--with-ld (it seems), the code should make sure this linker is used even
when called via gcc, so -B$LD (i.e. -Bld.bfd) needs to be passed to gcc.
If you know stuff about automake maybe you can discuss the proper way
with upstream at http://hackage.haskell.org/trac/ghc/?

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
Debian Developer
  nomeata at debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata at joachim-breitner.de | http://people.debian.org/~nomeata
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20120617/ee020e29/attachment.pgp>


More information about the Pkg-haskell-maintainers mailing list