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
*)
36 echo >&2 "$SELF: *WARNING* '$V' is not dynamically linked!"
38 *ELF
*relocatable
*,\ not\ stripped
*)
39 echo >&2 "$SELF: *WARNING* '$V' is a relocatable!"
43 *ELF
*executable
*,\ not\ stripped
*)
45 */lib
/modules
/2.
*.o
:*ELF
*relocatable
*,\ not\ stripped
* | \
46 */lib
/modules
/2.
*.ko
:*ELF
*relocatable
*,\ not\ stripped
*)
47 # kernel module parametres must not be stripped off
48 T
="$T --strip-unneeded $(echo $(${prefix}nm $F | \
49 sed -n -e '/__param_/s/^.*__param_/-K /p' \
50 -e '/__module_parm_/s/^.*__module_parm_/-K /p'))"
52 *ELF
*shared\ object
*,\ not\ stripped
*)