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
|
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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user