diff options
author | aszlig <aszlig@nix.build> | 2018-09-25 04:11:33 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2018-09-25 04:42:34 +0200 |
commit | 9920215d005db148564e826478474faa236a4e75 (patch) | |
tree | 4c4545e8aac74cae16002d027ac020063aa14ef0 /pkgs/build-support | |
parent | 58a97dfb491be6ae92499c3f819440f281d826a1 (diff) | |
download | nixlib-9920215d005db148564e826478474faa236a4e75.tar nixlib-9920215d005db148564e826478474faa236a4e75.tar.gz nixlib-9920215d005db148564e826478474faa236a4e75.tar.bz2 nixlib-9920215d005db148564e826478474faa236a4e75.tar.lz nixlib-9920215d005db148564e826478474faa236a4e75.tar.xz nixlib-9920215d005db148564e826478474faa236a4e75.tar.zst nixlib-9920215d005db148564e826478474faa236a4e75.zip |
autoPatchelfHook: Only check PT_INTERP on execs
If the ELF file is not an executable, we do not get a PT_INTERP section, because after all, it's a *shared* library. So instead of checking for PT_INTERP (to avoid statically linked executables) for all ELF files, we add another check to see if it's an executable and *only* skip it when it is and there's no PT_INTERP. Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/setup-hooks/auto-patchelf.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh index 94ea3e4e98e3..f808cd9f78d7 100644 --- a/pkgs/build-support/setup-hooks/auto-patchelf.sh +++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh @@ -155,8 +155,10 @@ autoPatchelf() { # outside of this function. while IFS= read -r -d $'\0' file; do isELF "$file" || continue - # dynamically linked? - readelf -l "$file" | grep -q "^ *INTERP\\>" || continue + if isExecutable "$file"; then + # Skip if the executable is statically linked. + readelf -l "$file" | grep -q "^ *INTERP\\>" || continue + fi autoPatchelfFile "$file" done < <(find "$prefix" -type f -print0) } |