mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-20 07:53:01 +02:00
Make stripping more efficient.
Finds all ELF objects and doesn't strip them twice.
This commit is contained in:
27
src/stripper
Executable file
27
src/stripper
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
function _strip() {
|
||||
local file=${1}
|
||||
|
||||
local cmd="${STRIP-strip}"
|
||||
|
||||
case "$(file -bi ${file})" in
|
||||
application/x-sharedlib*)
|
||||
cmd="${cmd} --strip-debug --remove-section=.comment --remove-section=.note"
|
||||
;;
|
||||
*)
|
||||
cmd="${cmd} --strip-unneeded"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Stripping ${file}..."
|
||||
${cmd} ${file}
|
||||
}
|
||||
|
||||
for dir in $@; do
|
||||
find ${dir} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
|
||||
| file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped/\1/p' |
|
||||
while read file; do
|
||||
_strip ${file}
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user