From 86fa0b4a29895715e3b63841cac99a4ece94b5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Wed, 29 Dec 2004 20:37:54 +0000 Subject: [PATCH] add exported symbols test git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14428 ec53bebd-3082-4978-b11e-865c3cabbd6b --- cf/check-symbols.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cf/check-symbols.sh diff --git a/cf/check-symbols.sh b/cf/check-symbols.sh new file mode 100644 index 000000000..57ec61de5 --- /dev/null +++ b/cf/check-symbols.sh @@ -0,0 +1,31 @@ +# check library exported symbols +# $Id$ + +esym= +symbols= + +while test $# != 0 ;do + case "$1" in + -lib) lib="$2" ; shift;; + -com_err) + esym="${esym} com_right\$ free_error_table\$ initialize_error_table_r\$" + esym="${esym} com_err error_message\$ error_table_name\$" + esym="${esym} init_error_table\$ add_to_error_table\$" + esym="${esym} reset_com_err_hook\$ set_com_err_hook\$ _et_list\$" + esym="${esym} initialize_[A-Za-z0-9]*_error_table" ;; + -version) + esym="${esym} print_version\$" ;; + -*) echo "unknown option $1" ; exit 1 ;; + *) break ;; + esac + shift +done + +for a in "$@" $esym; do + symbols="\$3 !~ /^${a}/ ${symbols:+&&} ${symbols}" +done + +(nm .libs/lib${lib}.a || nm .libs/lib${lib}.so*) | +awk "BEGIN { stat = 0 } +NF == 3 && \$2 ~ /[A-Z]/ && \$2 !~ /U/ && $symbols { printf \"%s should not be exported\\n\", \$3; ++stat } END { exit stat }" +