gcc-wrapper: Wrap ld.gold
This ensures that gcc's ‘-fuse-ld=gold’ flag works.
This commit is contained in:
parent
3e0a348728
commit
ffbdcbfe29
|
@ -143,6 +143,14 @@ stdenv.mkDerivation {
|
|||
|
||||
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
|
||||
wrap gcc ${./gcc-wrapper.sh} $gccPath/gcc
|
||||
ln -s gcc $out/bin/cc
|
||||
|
|
|
@ -285,19 +285,13 @@ rec {
|
|||
};
|
||||
|
||||
|
||||
/* Modify a stdenv so that it uses the Gold linker. FIXME: should
|
||||
use -fuse-ld=gold instead, but then the ld-wrapper won't be
|
||||
invoked. */
|
||||
useGoldLinker = stdenv:
|
||||
let
|
||||
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'; });
|
||||
/* Modify a stdenv so that it uses the Gold linker. */
|
||||
useGoldLinker = stdenv: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args // {
|
||||
dontStrip = true;
|
||||
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_COMPILE or "") + " -fuse-ld=gold";
|
||||
});
|
||||
};
|
||||
|
||||
dropCxx = drv: drv.override {
|
||||
stdenv = if pkgs.stdenv.isDarwin
|
||||
|
|
Loading…
Reference in a new issue