debuginfo: Warn if stripped ELFs are found

This commit is contained in:
Виталий Чикунов 2020-08-22 02:21:13 +03:00
parent 5b7f0b0e50
commit 1f5bc5f866

View File

@ -25,12 +25,21 @@ prune_tests="$(printf %s "$prune_paths" |
sort -u |
sed -n '/^\// s/.*/ -o -path .&/p')"
find . '(' -path './.*' $prune_tests ')' -prune -o -type f -print |sort |
file -NF$'\t' -f - |
file -NF$'\t' -f - >.tmp/file_full
sed -n -e 's/\t.* ELF .* \(executable\|shared object\), .*, stripped.*//p' <.tmp/file_full >.tmp/fstripped
if [ -s .tmp/fstripped ]; then
howmuch=$(wc -l <.tmp/fstripped)
Warning "You have $howmuch stripped ELF objects. Please compile with debugging information!"
Warning "An excerpt from the list of affected files follows:"
sed 's/^/ /; 10q' <.tmp/fstripped >&2
fi
sed -n -e '/ ELF .* shared object, no machine, /d' \
-e 's/\t.* ELF .* \(executable\|shared object\), .*, not stripped.*//p' \
-e 's/^\(\.\/lib\/modules\/[^[:space:]]\+\.ko\)\t.* ELF .* relocatable, .*, not stripped.*/\1/p' \
-e 's/^\(\.\/lib\/modules\/[^[:space:]]\+\.ko\.[gx]z\)\t.* \(gzip\|xz\) compressed data.*/\1/p' \
-e 's/^\(\.\/boot\/vmlinuz-[^[:space:]]\+\)\t.*/\1/p' |
-e 's/^\(\.\/boot\/vmlinuz-[^[:space:]]\+\)\t.*/\1/p' <.tmp/file_full |
xargs -r --delimiter='\n' stat -c '%h %i %n' >.tmp/flist
# Filter out what will be hard-linked later and process the rest.