Skip to content

Commit

Permalink
autoPatchelfHook: Only check PT_INTERP on execs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aszlig committed Sep 25, 2018
1 parent 58a97df commit 9920215
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkgs/build-support/setup-hooks/auto-patchelf.sh
Expand Up @@ -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)
}
Expand Down

0 comments on commit 9920215

Please sign in to comment.