tidy/strip: Fix incorrect recognition of static binaries as relocatable ones

This commit is contained in:
Vasiliy Stelmachenok 2024-07-01 09:26:59 +03:00 committed by Allan McRae
parent 9151c44658
commit 5213a70b88

View file

@ -167,7 +167,12 @@ tidy_strip() {
*Type:*'DYN (Position-Independent Executable file)'*) # Relocatable binaries
strip_flags="$STRIP_SHARED";;
*Type:*'EXEC (Executable file)'*) # Binaries
strip_flags="$STRIP_BINARIES";;
if [[ "$(readelf -x .dynamic "$binary" 2>/dev/null)" ]]; then
strip_flags="$STRIP_BINARIES"
else
strip_flags="$STRIP_STATIC"
fi
;;
*Type:*'REL (Relocatable file)'*) # Libraries (.a) or objects
if ar t "$binary" &>/dev/null; then # Libraries (.a)
strip_flags="$STRIP_STATIC"