summary refs log tree commit diff
path: root/pkgs/build-support/bintools-wrapper
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2021-09-17 16:59:12 +0200
committersternenseemann <sternenseemann@systemli.org>2021-09-18 15:11:17 +0200
commit11fe2fc3cfccb95f7b99f2a2d1096c851868e582 (patch)
tree9e1bcb733176136a40c1428d71fda850ae2d5787 /pkgs/build-support/bintools-wrapper
parent1174f3030c205ea654eb3e74e53ddf797493db30 (diff)
downloadnixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.tar
nixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.tar.gz
nixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.tar.bz2
nixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.tar.lz
nixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.tar.xz
nixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.tar.zst
nixpkgs-11fe2fc3cfccb95f7b99f2a2d1096c851868e582.zip
stdenv: move --enable-deterministic-archives flag into GNU wrapper
`--enable-deterministic-archives` is a GNU specific strip flag and
causes other strip implementations (for example LLVM's, see #138013)
to fail. Since strip failures are ignored, this means that stripping
doesn't work at all in certain situation (causing unnecessary
dependencies etc.).

To fix this, no longer pass `--enable-deterministic-archives`
unconditionally, but instead add it in a GNU binutils specific strip
wrapper only.

`commonStripFlags` was only used for this flag, so we can remove
it altogether.

Future work could be to make a generic strip wrapper, with support for
nix-support/strip-flags-{before,after} and NIX_STRIP_FLAGS_{BEFORE,AFTER}.
This possibly overkill and unnecessary though -- also with the
additional challenge of incorporating the darwin strip wrapper somehow.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper')
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix10
-rw-r--r--pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh4
2 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index 3d64639d33f..53f367b9b84 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -324,6 +324,16 @@ stdenv.mkDerivation {
       echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
     ''
 
+    ##
+    ## GNU specific extra strip flags
+    ##
+
+    # TODO(@sternenseemann): make a generic strip wrapper?
+    + optionalString (bintools.isGNU or false) ''
+      wrap ${targetPrefix}strip ${./gnu-binutils-strip-wrapper.sh} \
+        "${bintools_bin}/bin/${targetPrefix}strip"
+    ''
+
     ###
     ### Remove LC_UUID
     ###
diff --git a/pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh b/pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh
new file mode 100644
index 00000000000..5b5136e3d14
--- /dev/null
+++ b/pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh
@@ -0,0 +1,4 @@
+#! @shell@
+# shellcheck shell=bash
+
+exec @prog@ --enable-deterministic-archives "$@"