summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix2
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix3
-rw-r--r--pkgs/build-support/setup-hooks/strip.sh2
-rw-r--r--pkgs/development/compilers/gcc/common/strip-attributes.nix37
4 files changed, 30 insertions, 14 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index cdd07d6b2ef..b54983986db 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -365,7 +365,7 @@ stdenv.mkDerivation {
     ##
     + extraBuildCommands;
 
-  inherit dynamicLinker expand-response-params;
+  inherit dynamicLinker;
 
   # for substitution in utils.bash
   expandResponseParams = "${expand-response-params}/bin/expand-response-params";
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index f8e28c452c3..ad8104246aa 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -157,6 +157,8 @@ stdenv.mkDerivation {
         '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
     '';
 
+    inherit expand-response-params;
+
     inherit nixSupport;
   };
 
@@ -540,7 +542,6 @@ stdenv.mkDerivation {
         (name: value: "echo ${toString value} >> $out/nix-support/${name}")
         nixSupport);
 
-  inherit expand-response-params;
 
   # for substitution in utils.bash
   expandResponseParams = "${expand-response-params}/bin/expand-response-params";
diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh
index 80bc064ced7..b2d0841888f 100644
--- a/pkgs/build-support/setup-hooks/strip.sh
+++ b/pkgs/build-support/setup-hooks/strip.sh
@@ -44,7 +44,7 @@ stripDirs() {
 
     local d
     for d in ${dirs}; do
-        if [ -d "$prefix/$d" ]; then
+        if [ -e "$prefix/$d" ]; then
             dirsNew="${dirsNew} $prefix/$d "
         fi
     done
diff --git a/pkgs/development/compilers/gcc/common/strip-attributes.nix b/pkgs/development/compilers/gcc/common/strip-attributes.nix
index 997c068cba6..9756c468b71 100644
--- a/pkgs/development/compilers/gcc/common/strip-attributes.nix
+++ b/pkgs/development/compilers/gcc/common/strip-attributes.nix
@@ -8,7 +8,9 @@
   # Example ARM breakage by x86_64 strip: https://bugs.gentoo.org/697428
   #
   # Let's recap the file layout for directories with object files for a
-  # cross-compiler (host != target):
+  # cross-compiler:
+  #
+  # $out (host != target)
   # `- bin: HOST
   #    lib/*.{a,o}: HOST
   #      `- gcc/<TARGET>/<VERSION>/*.{a,o}: TARGET
@@ -17,10 +19,16 @@
   #  `- libexec/: HOST
   #  `- <TARGET>/: TARGET
   #
-  # (host == target) has identical directory layout.
+  # $out (host == target) has identical directory layout.
+  #
+  # $lib (host != target):
+  # `- <TARGET>/lib/*.{la,so}: TARGET
+  #
+  # $lib (host == target):
+  # `- lib/*.{la,so}: HOST
 
   # The rest of stripDebugList{Host,Target} will be populated in
-  # postInstall.
+  # postInstall to disambiguate lib/ object files.
   stripDebugList = [ "bin" "libexec" ];
   stripDebugListTarget = [ stdenv.targetPlatform.config ];
 
@@ -32,21 +40,28 @@
       shopt -s nullglob
 
       pushd $out
-
-      local -ar hostFiles=(
-        lib{,32,64}/*.{a.o}
+      local -ar outHostFiles=(
+        lib{,32,64}/*.{a,o,so*}
         lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/plugin
       )
-      local -ar targetFiles=(
-        lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/*.{a.o}
+      local -ar outTargetFiles=(
+        lib{,32,64}/gcc/${stdenv.targetPlatform.config}/*/*.{a,o,so*}
       )
+      popd
 
-      stripDebugList="$stripDebugList ''${hostFiles[*]}"
-      stripDebugListTarget="$stripDebugListTarget ''${targetFiles[*]}"
-
+      pushd $lib
+      local -ar libHostFiles=(
+        lib{,32,64}/*.{a,o,so*}
+      )
+      local -ar libTargetFiles=(
+        lib{,32,64}/${stdenv.targetPlatform.config}/*.{a,o,so*}
+      )
       popd
 
       eval "$oldOpts"
+
+      stripDebugList="$stripDebugList ''${outHostFiles[*]} ''${libHostFiles[*]}"
+      stripDebugListTarget="$stripDebugListTarget ''${outTargetFiles[*]} ''${libTargetFiles[*]}"
     }
     updateDebugListPaths
   '';