From: David Schleef Date: Mon, 13 Aug 2001 11:08:05 +0000 (+0000) Subject: Add check on .o file for symbol leakage X-Git-Tag: r0_7_61~173 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=752e15af2d20a6fcf0f610a4d8e5e1e008adf5f9;p=comedi.git Add check on .o file for symbol leakage --- diff --git a/comedi/drivers/check_driver b/comedi/drivers/check_driver index 0c81315a..a6b7b1b2 100755 --- a/comedi/drivers/check_driver +++ b/comedi/drivers/check_driver @@ -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 ' ' ${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 +