Changeset 20962 in vbox for trunk/src/bldprogs
- Timestamp:
- Jun 26, 2009 9:23:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/checkUndefined.sh
r20934 r20962 28 28 } 29 29 30 target=$1 31 symbols=$2 32 static=$3 30 hostos=$1 31 target=$2 32 symbols=$3 33 static=$4 33 34 34 if [ $# -lt 2 -o $# -gt 3 -o ! -r $target -o ! -r $symbols ] 35 then 36 if [ ! -r $target ] 37 then 38 echoerr "$0: $target not readable" 39 elif [ ! -r $symbols ] 40 then 41 echoerr "$0: $symbols not readable" 35 if test $# -lt 3 || test $# -gt 4 || test ! -r "$target" || test ! -r "$symbols"; then 36 if test ! -r "$target"; then 37 echoerr "$0: '$target' not readable" 38 elif test ! -r "$symbols"; then 39 echoerr "$0: '$symbols' not readable" 42 40 else 43 41 echoerr "$0: Wrong number of arguments" … … 46 44 fi 47 45 48 if [ $# -eq 3 -a ! "$static" = "--static" ] 49 then 46 if test $# -eq 4 && test "$static" != "--static"; then 50 47 args_ok="no" 51 48 fi 52 49 53 if [ "$args_ok" = "no" ] 54 then 50 if test "$args_ok" = "no"; then 55 51 echoerr "Usage: $0 <object> <allowed undefined symbols> [--static]" 56 52 exit 1 57 53 fi 58 54 55 if test "$hostos" = "solaris"; then 56 objdumpbin=/usr/sfw/bin/gobjdump 57 grepbin=/usr/sfw/bin/ggrep 58 elif test "$hostos" = "linux"; then 59 objdumpbin=`which objdump` 60 grepbin=`which grep` 61 else 62 echoerr "$0: '$hostos' not a valid hostos string. supported 'linux' 'solaris'" 63 exit 1 64 fi 65 59 66 command="-T" 60 if [ "$static" = "--static" ] 61 then 67 if test "$static" = "--static"; then 62 68 command="-t" 63 69 fi 64 70 65 undefined=`objdump $command $target | grep '*UND*' | grep -v -f $symbols | sed -e 's/^.*[ ]\(.*\)/\1/'` 71 if test ! -x "$objdumpbin"; then 72 echoerr "$0: '$objdumpbin' not found or not executable." 73 exit 1 74 fi 75 76 undefined=`$objdumpbin $command $target | $grepbin '*UND*' | $grepbin -v -f $symbols | sed -e 's/^.*[ ]\(.*\)/\1/'` 66 77 num_undef=`echo $undefined | wc -w` 67 78 68 if [ $num_undef -ne 0 ] 69 then 79 if test $num_undef -ne 0; then 70 80 echoerr "$0: following symbols not defined in $symbols:" 71 81 echoerr "$undefined" 82 exit 1 72 83 fi 73 84 # Return code 74 [ $num_undef -eq 0 ] 85 exit 0 86 87
Note:
See TracChangeset
for help on using the changeset viewer.