From 5b46a7c240fe9e22a673d7dbd107498e042b437b Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 6 Mar 2018 10:15:05 -0600 Subject: [PATCH] gcc7: make building w/LTO support optional, don't use in bootstrap tools --- pkgs/development/compilers/gcc/7/default.nix | 3 ++- pkgs/stdenv/linux/make-bootstrap-tools.nix | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 68c05d28978..39b3e4734fe 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -6,6 +6,7 @@ , profiledCompiler ? false , staticCompiler ? false , enableShared ? true +, enableLTO ? true , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which @@ -257,7 +258,7 @@ stdenv.mkDerivation ({ # Basic configuration [ - "--enable-lto" + (if enableLTO then "--enable-lto" else "--disable-lto") "--disable-libstdcxx-pch" "--without-included-gettext" "--with-system-zlib" diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 8d513625df2..86503b96245 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -33,6 +33,8 @@ in with pkgs; rec { ''; }; + bootGCC = gcc.cc.override { enableLTO = false; }; + build = stdenv.mkDerivation { @@ -109,12 +111,12 @@ in with pkgs; rec { cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep # Copy what we need of GCC. - cp -d ${gcc.cc.out}/bin/gcc $out/bin - cp -d ${gcc.cc.out}/bin/cpp $out/bin - cp -d ${gcc.cc.out}/bin/g++ $out/bin - cp -d ${gcc.cc.lib}/lib/libgcc_s.so* $out/lib - cp -d ${gcc.cc.lib}/lib/libstdc++.so* $out/lib - cp -rd ${gcc.cc.out}/lib/gcc $out/lib + cp -d ${bootGCC.out}/bin/gcc $out/bin + cp -d ${bootGCC.out}/bin/cpp $out/bin + cp -d ${bootGCC.out}/bin/g++ $out/bin + cp -d ${bootGCC.lib}/lib/libgcc_s.so* $out/lib + cp -d ${bootGCC.lib}/lib/libstdc++.so* $out/lib + cp -rd ${bootGCC.out}/lib/gcc $out/lib chmod -R u+w $out/lib rm -f $out/lib/gcc/*/*/include*/linux rm -f $out/lib/gcc/*/*/include*/sound @@ -122,11 +124,11 @@ in with pkgs; rec { rm -f $out/lib/gcc/*/*/include-fixed/asm rm -rf $out/lib/gcc/*/*/plugin #rm -f $out/lib/gcc/*/*/*.a - cp -rd ${gcc.cc.out}/libexec/* $out/libexec + cp -rd ${bootGCC.out}/libexec/* $out/libexec chmod -R u+w $out/libexec rm -rf $out/libexec/gcc/*/*/plugin mkdir -p $out/include - cp -rd ${gcc.cc.out}/include/c++ $out/include + cp -rd ${bootGCC.out}/include/c++ $out/include chmod -R u+w $out/include rm -rf $out/include/c++/*/ext/pb_ds rm -rf $out/include/c++/*/ext/parallel