From 752e15af2d20a6fcf0f610a4d8e5e1e008adf5f9 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 13 Aug 2001 11:08:05 +0000 Subject: [PATCH] Add check on .o file for symbol leakage --- comedi/drivers/check_driver | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 + -- 2.26.2