mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
bintools-wrapper: look only at shared libraries in library directories
To decide whether a store library directory belongs in the rpath, ld-wrapper looks up each entry of the directory among the libraries being linked. But those are all named lib*.so (from -l), or *.so or *.so.* (when given by path), so only entries matching *.so* can be among them. List only those, leaving bash with far fewer entries to look up; the directory is still read just once. Linking an empty C program with 1500 different store library directories, which together have 12241 entries but only 7614 matching *.so*, now takes about 0.40 s instead of 0.44 s, in a VM where starting a process is slow. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
@@ -221,7 +221,9 @@ if [[ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 && "$linkType" != static-pie ]]; t
|
||||
if [ -n "${rpaths[$dir]:-}" ] || [[ "$dir" != "${NIX_STORE:-}"/* ]]; then
|
||||
continue
|
||||
fi
|
||||
for path in "$dir"/*; do
|
||||
# Every name in libs is that of a shared library, ending in .so or
|
||||
# containing .so., so the rest of the directory can be skipped.
|
||||
for path in "$dir"/*.so*; do
|
||||
file="${path##*/}"
|
||||
if [ "${libs[$file]:-}" ]; then
|
||||
# This library may have been provided by a previous directory,
|
||||
|
||||
Reference in New Issue
Block a user