1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 [[ -n $BASH_VERSION ]] && shopt -s extglob
8 if [[ -z $prefix ]]; then
9 echo >&2 "$SELF: strip command not defined ('prefix' variable not set)"
13 if [[ $1 = +keep
]]; then
17 stripcomm
=" -R .comment"
22 if [[ -z $TARGETS ]]; then
23 echo >&2 "$SELF: no directories / files specified"
24 echo >&2 "usage: $SELF [PATH...]"
28 find $TARGETS -type f
-a -exec file {} \
; | \
29 while IFS
= read -r line
; do
31 V
=${F##*/fake-+([!/])/}
35 *ELF
*executable
*statically\ linked
*)
37 *ELF
*relocatable
*,\ not\ stripped
*)
41 *ELF
*executable
*,\ not\ stripped
*)
43 */lib
/modules
/2.
*.o
:*ELF
*relocatable
*,\ not\ stripped
* | \
44 */lib
/modules
/2.
*.ko
:*ELF
*relocatable
*,\ not\ stripped
*)
45 # kernel module parametres must not be stripped off
46 T
="$T --strip-unneeded $(echo $(${prefix}nm $F | \
47 sed -n -e '/__param_/s/^.*__param_/-K /p' \
48 -e '/__module_parm_/s/^.*__module_parm_/-K /p'))"
50 *ELF
*shared\ object
*,\ not\ stripped
*)