From 9920215d005db148564e826478474faa236a4e75 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 25 Sep 2018 04:11:33 +0200 Subject: [PATCH] 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 --- pkgs/build-support/setup-hooks/auto-patchelf.sh | 6 ++++-- 1 file 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) }