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 | |
parent | 11707e4f87eddb84267e88588aee48cbaf7b44bb (diff) | |
download | krb5-33c1fbd68f77f0fa60283c0f42f1c820a8d1f11c.tar.gz krb5-33c1fbd68f77f0fa60283c0f42f1c820a8d1f11c.tar.xz krb5-33c1fbd68f77f0fa60283c0f42f1c820a8d1f11c.zip |
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
-rw-r--r-- | src/config/ChangeLog | 3 | ||||
-rw-r--r-- | src/config/shlib.conf | 2 | ||||
-rw-r--r-- | src/util/ChangeLog | 4 | ||||
-rwxr-xr-x | src/util/export-check.pl | 55 |
4 files changed, 63 insertions, 1 deletions
diff --git a/src/config/ChangeLog b/src/config/ChangeLog index 6296210ad..5bfca9ee6 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -1,5 +1,8 @@ 2006-01-25 Ken Raeburn <raeburn@mit.edu> + * shlib.conf (*-*-linux*): Run export-check.pl after building a + shared library. + * lib.in (binutils.versions): Put hidden symbol list after exported list, because libkrb4 has a symbol starting with "__" in its export list. diff --git a/src/config/shlib.conf b/src/config/shlib.conf index 9d9a2066b..a7ec085c3 100644 --- a/src/config/shlib.conf +++ b/src/config/shlib.conf @@ -354,7 +354,7 @@ mips-*-netbsd*) # Use objdump -x to examine the fields of the library LDCOMBINE='$(CC) -shared -fPIC -Wl,-h,$(LIBPREFIX)$(LIBBASE)$(SHLIBSEXT)' # - LDCOMBINE_TAIL='-Wl,--version-script binutils.versions' + LDCOMBINE_TAIL='-Wl,--version-script binutils.versions && $(PERL) -w $(SRCTOP)/util/export-check.pl $(SHLIB_EXPORT_FILE) $@' SHLIB_EXPORT_FILE_DEP=binutils.versions # For cases where we do have dependencies on other libraries # built in this tree... 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; |