summary refs log tree commit diff
path: root/pkgs/stdenv/linux
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-03-03 12:09:50 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-03 13:57:45 +0100
commit5702bc3b55968f8793327a0b5fd46ea446e3e487 (patch)
tree0ea0e976d5222d5e9fcbbfd976f664887413102e /pkgs/stdenv/linux
parent639d7409f2353b754c1d964acc88f9ffea6ab058 (diff)
downloadnixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.tar
nixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.tar.gz
nixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.tar.bz2
nixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.tar.lz
nixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.tar.xz
nixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.tar.zst
nixpkgs-5702bc3b55968f8793327a0b5fd46ea446e3e487.zip
make-bootstrap-tools: fix #13629: glibc problems
On x86_64-linux glibc started to use linker scripts more extensively.

(cherry picked from commit aa564c9ed01268e7e0b030942592bc3beb642eef)
Diffstat (limited to 'pkgs/stdenv/linux')
-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 974f5475341..4a7f057cb6c 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