[Nix-dev] overriding binutils in gcc
Lluís Batlle
viriketo at gmail.com
Thu Jan 14 23:24:39 CET 2010
2010/1/14 Rohan Hart <rohan.hart17 at gmail.com>:
> Hi
>
> Now that my hacked binutils builds gold rather than ld I can't work
> out how to make a gcc which uses it. From the docs it would seem to
> be something like:
>
> gccGold = wrapGCC (gcc43_real.gcc.override {
> stdenv = overrideInStdenv stdenv [binutilsGold];
> });
>
> but while that builds gold it uses the standard binutils ld.
The 'ld' used by gcc when linking (instead of calling the 'ld' in
PATH) is defined I think in the gcc wrapper.
Check this part of all-packages.nix:
wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;
nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc;
nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else "";
gcc = baseGCC;
libc = glibc;
inherit stdenv binutils;
};
wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc;
Look at the 'inherit ... binutils' there. You want a 'wrapGCCWith'
specific using your gold.
Pay attention, that the whole gcc wrapper includes the wrapper for ld.
If you check the 'pkgs/stdenv/generic/setup.sh' generic builder, you
will notice around line 90 this:
# Set up the initial path.
PATH=
for i in $NIX_GCC @initialPath@; do
if test "$i" = /; then i=; fi
addToSearchPath PATH $i/bin
done
So the gcc wrapper gets *first* in the path. With the expression you
used, I think gold went into the PATH, but *after* the ld in
gcc-wrapper.
Thank you for your work in 'gold'! Please let us know the results.
Regards,
Lluís.
More information about the nix-dev
mailing list