Add check on .o file for symbol leakage
authorDavid Schleef <ds@schleef.org>
Mon, 13 Aug 2001 11:08:05 +0000 (11:08 +0000)
committerDavid Schleef <ds@schleef.org>
Mon, 13 Aug 2001 11:08:05 +0000 (11:08 +0000)
comedi/drivers/check_driver

index 0c81315a7c724c6a54976f991843d4ee2fcdbd23..a6b7b1b25ba013b5ac2a586d694305c21242402e 100755 (executable)
@@ -32,7 +32,7 @@ esac
 
 
 # check to see if it is a driver
-if grep '^comedi_driver' ${driver} &>/dev/null;then
+if grep '^\(static \)*comedi_driver' ${driver} &>/dev/null;then
        echo "appears to be a driver"
 else
        echo "not a driver file"
@@ -286,3 +286,14 @@ if grep '\r' ${driver} &>/dev/null;then
        echo "E: driver has ^M characters"
 fi
 
+if [ -f "${basedriver}.o" ];then
+       # .o checks
+       n_syms=$(nm ${basedriver}.o |grep -c ' [TDC] ')
+       echo "number of global symbols: $n_syms"
+       n_xsyms=$(nm ${basedriver}.o |grep -c ' __ksymtab')
+       echo "number of exported symbols: $n_xsyms"
+       if [ $(($n_syms-$n_xsyms)) -gt 3 ];then
+               echo "W: driver leaks symbols"
+       fi
+fi
+