about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2016-03-03 16:11:55 +0000
committerRobin Gloster <mail@glob.in>2016-03-03 16:11:55 +0000
commitfed49425c51e66d0278f376eb2e2aa67843269d5 (patch)
tree3149d7484ff8a1e48359c801753f13afbf22157a /pkgs/stdenv
parent4c9c4c4dcdf406adb235682ab4d50985513f92e3 (diff)
parent7a360b13a0ac35c0f6109d251880ae698c13b221 (diff)
Merge remote-tracking branch 'upstream/master' into hardened-stdenv
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index ef651f6436840..3c89486997267 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -51,7 +51,15 @@ rec {
         cp -d ${glibc}/lib/crt?.o $out/lib
 
         cp -rL ${glibc}/include $out
-        chmod -R u+w $out/include
+        chmod -R u+w "$out"
+
+        # glibc can contain linker scripts: find them, copy their deps,
+        # and get rid of absolute paths (nuke-refs would make them useless)
+        local lScripts=$(grep --files-with-matches --max-count=1 'GNU ld script' -R "$out/lib")
+        cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${glibc}' | sort -u)
+        for f in $lScripts; do
+          substituteInPlace "$f" --replace '${glibc}/lib/' ""
+        done
 
         # Hopefully we won't need these.
         rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video