diff options
| author | Ken Raeburn <raeburn@mit.edu> | 2006-01-25 06:35:19 +0000 |
|---|---|---|
| committer | Ken Raeburn <raeburn@mit.edu> | 2006-01-25 06:35:19 +0000 |
| commit | 33c1fbd68f77f0fa60283c0f42f1c820a8d1f11c (patch) | |
| tree | 4c23d6cf5f6709b596946108dcd0bde1c7087aa7 /src/util | |
| parent | 11707e4f87eddb84267e88588aee48cbaf7b44bb (diff) | |
Check the export lists against the newly built shared library to make sure all
the symbols we want to export are actually defined. GNU/Linux only, for the
moment, but it ought to work on any system using the GNU version of nm, and not
too hard to modify for other ways of extracting the exported symbols of a
library.
* util/export-check.pl: New file.
* config/shlib.conf (*-*-linux*): Run export-check.pl after building a shared
library.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17609 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/ChangeLog | 4 | ||||
| -rwxr-xr-x | src/util/export-check.pl | 55 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/util/ChangeLog b/src/util/ChangeLog index a306f5d92..b7c87caa5 100644 --- a/src/util/ChangeLog +++ b/src/util/ChangeLog @@ -1,3 +1,7 @@ +2006-01-25 Ken Raeburn <raeburn@mit.edu> + + * export-check.pl: New file. + 2005-12-22 Ken Raeburn <raeburn@mit.edu> * depfix.pl (uniquify): New subroutine. diff --git a/src/util/export-check.pl b/src/util/export-check.pl new file mode 100755 index 000000000..67c8e853d --- /dev/null +++ b/src/util/export-check.pl @@ -0,0 +1,55 @@ +# +$0 =~ s/^.*?([\w.-]+)$/$1/; + +# The real stuff. + +# Args: exportlist libfoo.so + +# This code assumes the GNU version of nm. +# For now, we'll only run it on GNU/Linux systems, so that's okay. + +if ($#ARGV != 1) { + die "usage: $0 exportfile libfoo.so\n"; +} +my($exfile, $libfile) = @ARGV; + +@missing = (); +open NM, "nm -Dg --defined-only $libfile |" || die "can't run nm on $libfile: $!"; +open EXPORT, "< $exfile" || die "can't read $exfile: $!"; + +@export = <EXPORT>; +map chop, @export; +@export = sort @export; + +@found = (); +while (<NM>) { + chop; + s/^[0-9a-fA-F]+ +//; + next if /^A /; + if (!/^[TDRB] /) { + unlink $libfile; + die "not sure what to do with '$_'"; + } + s/^[TDRB] +//; + push @found, $_; +} +@found = sort @found; +while ($#export >= 0 && $#found >= 0) { + if ($export[0] eq $found[0]) { +# print "ok $export[0]\n"; + shift @export; + shift @found; + } elsif ($export[0] lt $found[0]) { + push @missing, shift @export; + } else { + # Ignore added symbols, for now. + shift @found; + } +} +if ($#export >= 0) { @missing = (@missing, @export); } +if ($#missing >= 0) { + print STDERR "Missing symbols:\n\t", join("\n\t", @missing), "\n"; +# unlink $libfile; + exit(1); +} +exit 0; |
