Skip to content

Commit

Permalink
gcc: allow stripping gcc libraries
Browse files Browse the repository at this point in the history
When cross compiling to the same kernel / arch combination, it is safe
to use strip of libraries. This happens when cross-compiling musl
programs. dontStrip is now set in each gcc compiler instead of in
gcc/builder.sh.

Fixes NixOS#75476
  • Loading branch information
matthewbauer authored and teburd committed Apr 9, 2021
1 parent 02fa062 commit 2274c51
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
&& stdenv.targetPlatform == stdenv.hostPlatform
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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
&& stdenv.targetPlatform == stdenv.hostPlatform
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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
&& stdenv.targetPlatform == stdenv.hostPlatform
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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
&& stdenv.targetPlatform == stdenv.hostPlatform
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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
&& stdenv.targetPlatform == stdenv.hostPlatform
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
Expand Down
6 changes: 3 additions & 3 deletions pkgs/development/compilers/gcc/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ if test "$noSysDirs" = "1"; then
fi
fi

if test -n "${targetConfig-}"; then
# The host strip will destroy some important details of the objects
dontStrip=1
if [ -n "${targetConfig-}" ] && [ -z "${stripDebugList-}" ]; then
# if stripping gcc, include target directory too
stripDebugList="lib lib32 lib64 libexec bin sbin $targetConfig"
fi

eval "$oldOpts"
Expand Down

0 comments on commit 2274c51

Please sign in to comment.