about summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/10/default.nix
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-07-22 21:40:08 +0100
committerSergei Trofimovich <slyich@gmail.com>2022-07-25 11:06:58 +0100
commiteece5d0dc0bbd7eaab1f09e608f89449f745003b (patch)
tree681b643e52ea45fdd2617c28cf36c040bdb11da9 /pkgs/development/compilers/gcc/10/default.nix
parent05077250615fa33003eada31a76b36c0717d8ca4 (diff)
gcc: enable stripping for cross-compilers
With explicit support for distinction between Host and Target strip paths
we can now safely strip ELF binaries with their according strip tools
without fear of damaging binaries due to architecture mismatch.

Closure size change for `pkgsCross.mingwW64.gcc12Stdenv.cc.cc`:

    # before:
    $ nix path-info -Sh $(nix-build -A pkgsCross.mingwW64.gcc12Stdenv.cc.cc) | unnix
    /<<NIX>>/x86_64-w64-mingw32-stage-final-gcc-debug-12.1.0           2.5G

    # after:
    $ nix path-info -Sh $(nix-build -A pkgsCross.mingwW64.gcc12Stdenv.cc.cc) | unnix
    /<<NIX>>/x86_64-w64-mingw32-stage-final-gcc-12.1.0         1.5G
Diffstat (limited to 'pkgs/development/compilers/gcc/10/default.nix')
-rw-r--r--pkgs/development/compilers/gcc/10/default.nix16
1 files changed, 7 insertions, 9 deletions
diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix
index 1b9f542894e07..fed9194e7c1cc 100644
--- a/pkgs/development/compilers/gcc/10/default.nix
+++ b/pkgs/development/compilers/gcc/10/default.nix
@@ -24,9 +24,6 @@
 , libcCross ? null
 , threadsCross ? null # for MinGW
 , crossStageStatic ? false
-, # Strip kills static libs of other archs (hence no cross)
-  stripped ? stdenv.hostPlatform.system == stdenv.buildPlatform.system
-          && stdenv.targetPlatform.system == stdenv.hostPlatform.system
 , gnused ? null
 , cloog # unused; just for compat with gcc4, as we override the parameter on some places
 , buildPackages
@@ -86,7 +83,7 @@ let majorVersion = "10";
 in
 
 stdenv.mkDerivation ({
-  pname = "${crossNameAddon}${name}${if stripped then "" else "-debug"}";
+  pname = "${crossNameAddon}${name}";
   inherit version;
 
   builder = ../builder.sh;
@@ -231,9 +228,11 @@ stdenv.mkDerivation ({
     (targetPlatform == hostPlatform && hostPlatform == buildPlatform)
     (if profiledCompiler then "profiledbootstrap" else "bootstrap");
 
-  dontStrip = !stripped;
-
-  installTargets = optional stripped "install-strip";
+  inherit
+    (import ../common/strip-attributes.nix { inherit stdenv; })
+    stripDebugList
+    stripDebugListTarget
+    preFixup;
 
   # https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
   ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
@@ -274,8 +273,7 @@ stdenv.mkDerivation ({
   meta = {
     homepage = "https://gcc.gnu.org/";
     license = lib.licenses.gpl3Plus;  # runtime support libraries are typically LGPLv3+
-    description = "GNU Compiler Collection, version ${version}"
-      + (if stripped then "" else " (with debugging info)");
+    description = "GNU Compiler Collection, version ${version}";
 
     longDescription = ''
       The GNU Compiler Collection includes compiler front ends for C, C++,