gcc-wrapper: Wrap ld.gold

This ensures that gcc's ‘-fuse-ld=gold’ flag works.
This commit is contained in:
Eelco Dolstra 2014-10-10 14:01:38 +02:00
parent 3e0a348728
commit ffbdcbfe29
2 changed files with 15 additions and 13 deletions

View File

@ -143,6 +143,14 @@ stdenv.mkDerivation {
wrap ld ${./ld-wrapper.sh} $ld wrap ld ${./ld-wrapper.sh} $ld
if [ -e $binutils/bin/ld.gold ]; then
wrap ld.gold ${./ld-wrapper.sh} $binutils/bin/ld.gold
fi
if [ -e $binutils/bin/ld.bfd ]; then
wrap ld.bfd ${./ld-wrapper.sh} $binutils/bin/ld.bfd
fi
if [ -e $gccPath/gcc ]; then if [ -e $gccPath/gcc ]; then
wrap gcc ${./gcc-wrapper.sh} $gccPath/gcc wrap gcc ${./gcc-wrapper.sh} $gccPath/gcc
ln -s gcc $out/bin/cc ln -s gcc $out/bin/cc

View File

@ -285,19 +285,13 @@ rec {
}; };
/* Modify a stdenv so that it uses the Gold linker. FIXME: should /* Modify a stdenv so that it uses the Gold linker. */
use -fuse-ld=gold instead, but then the ld-wrapper won't be useGoldLinker = stdenv: stdenv //
invoked. */ { mkDerivation = args: stdenv.mkDerivation (args // {
useGoldLinker = stdenv: dontStrip = true;
let NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_COMPILE or "") + " -fuse-ld=gold";
binutils = stdenv.gcc.binutils; });
binutils' = pkgs.runCommand "${binutils.name}-gold" { } };
''
mkdir -p $out/bin
ln -s ${binutils}/bin/* $out/bin/
ln -sfn ${binutils}/bin/ld.gold $out/bin/ld
''; # */
in overrideGCC stdenv (stdenv.gcc.override { binutils = binutils'; });
dropCxx = drv: drv.override { dropCxx = drv: drv.override {
stdenv = if pkgs.stdenv.isDarwin stdenv = if pkgs.stdenv.isDarwin