gcc7: make building w/LTO support optional, don't use in bootstrap tools

This commit is contained in:
Will Dietz 2018-03-06 10:15:05 -06:00 committed by Frederik Rietdijk
parent 9920076549
commit 5b46a7c240
2 changed files with 12 additions and 9 deletions

View File

@ -6,6 +6,7 @@
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true , enableShared ? true
, enableLTO ? true
, texinfo ? null , texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man) , perl ? null # optional, for texi2pod (then pod2man)
, gmp, mpfr, libmpc, gettext, which , gmp, mpfr, libmpc, gettext, which
@ -257,7 +258,7 @@ stdenv.mkDerivation ({
# Basic configuration # Basic configuration
[ [
"--enable-lto" (if enableLTO then "--enable-lto" else "--disable-lto")
"--disable-libstdcxx-pch" "--disable-libstdcxx-pch"
"--without-included-gettext" "--without-included-gettext"
"--with-system-zlib" "--with-system-zlib"

View File

@ -33,6 +33,8 @@ in with pkgs; rec {
''; '';
}; };
bootGCC = gcc.cc.override { enableLTO = false; };
build = build =
stdenv.mkDerivation { stdenv.mkDerivation {
@ -109,12 +111,12 @@ in with pkgs; rec {
cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep
# Copy what we need of GCC. # Copy what we need of GCC.
cp -d ${gcc.cc.out}/bin/gcc $out/bin cp -d ${bootGCC.out}/bin/gcc $out/bin
cp -d ${gcc.cc.out}/bin/cpp $out/bin cp -d ${bootGCC.out}/bin/cpp $out/bin
cp -d ${gcc.cc.out}/bin/g++ $out/bin cp -d ${bootGCC.out}/bin/g++ $out/bin
cp -d ${gcc.cc.lib}/lib/libgcc_s.so* $out/lib cp -d ${bootGCC.lib}/lib/libgcc_s.so* $out/lib
cp -d ${gcc.cc.lib}/lib/libstdc++.so* $out/lib cp -d ${bootGCC.lib}/lib/libstdc++.so* $out/lib
cp -rd ${gcc.cc.out}/lib/gcc $out/lib cp -rd ${bootGCC.out}/lib/gcc $out/lib
chmod -R u+w $out/lib chmod -R u+w $out/lib
rm -f $out/lib/gcc/*/*/include*/linux rm -f $out/lib/gcc/*/*/include*/linux
rm -f $out/lib/gcc/*/*/include*/sound rm -f $out/lib/gcc/*/*/include*/sound
@ -122,11 +124,11 @@ in with pkgs; rec {
rm -f $out/lib/gcc/*/*/include-fixed/asm rm -f $out/lib/gcc/*/*/include-fixed/asm
rm -rf $out/lib/gcc/*/*/plugin rm -rf $out/lib/gcc/*/*/plugin
#rm -f $out/lib/gcc/*/*/*.a #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 chmod -R u+w $out/libexec
rm -rf $out/libexec/gcc/*/*/plugin rm -rf $out/libexec/gcc/*/*/plugin
mkdir -p $out/include 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 chmod -R u+w $out/include
rm -rf $out/include/c++/*/ext/pb_ds rm -rf $out/include/c++/*/ext/pb_ds
rm -rf $out/include/c++/*/ext/parallel rm -rf $out/include/c++/*/ext/parallel