diff options
Diffstat (limited to 'pkgs/stdenv/linux')
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 19 | ||||
-rw-r--r-- | pkgs/stdenv/linux/make-bootstrap-tools.nix | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 63a37d54547..1fbd3cba27e 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -258,6 +258,25 @@ in # Rewrap the binutils with the new glibc, so both the next # stage's wrappers use it. libc = getLibc self; + + # Unfortunately, when building gcc in the next stage, its LTO plugin + # would use the final libc but `ld` would use the bootstrap one, + # and that can fail to load. Therefore we upgrade `ld` to use newer libc; + # apparently the interpreter needs to match libc, too. + bintools = self.stdenvNoCC.mkDerivation { + inherit (prevStage.bintools.bintools) name; + dontUnpack = true; + dontBuild = true; + # We wouldn't need to *copy* all, but it's easier and the result is temporary anyway. + installPhase = '' + mkdir -p "$out"/bin + cp -a '${prevStage.bintools.bintools}'/bin/* "$out"/bin/ + chmod +w "$out"/bin/ld.bfd + patchelf --set-interpreter '${getLibc self}'/lib/ld*.so.? \ + --set-rpath "${getLibc self}/lib:$(patchelf --print-rpath "$out"/bin/ld.bfd)" \ + "$out"/bin/ld.bfd + ''; + }; }; }; }) diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 4db40a2e516..0eee6e692fd 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -183,7 +183,7 @@ in with pkgs; rec { nuke-refs $out/lib/* nuke-refs $out/libexec/gcc/*/*/* nuke-refs $out/lib/gcc/*/*/* - nuke-refs $out/lib/gcc/*/*/include-fixed/*/* + nuke-refs $out/lib/gcc/*/*/include-fixed/*{,/*} mkdir $out/.pack mv $out/* $out/.pack |