diff --git a/ChangeLog b/ChangeLog index 2c0475ba4..c7af32d22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-03-12 Peter Stephenson + * zsh-users/7160: Src/Zle/zle_misc.c, Src/Zle/zle_utils.c, + Util/check_exports: Check and fix mod_export entries. + * 19615: Etc/MACHINES: update information. 2004-03-12 Oliver Kiddle diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index bd59653d6..1d274a93e 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -73,7 +73,7 @@ selfinsert(char **args) } /**/ -int +mod_export int selfinsertunmeta(char **args) { lastchar &= 0x7f; diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index 53fef20e5..69b4e6e42 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -388,7 +388,7 @@ printbind(char *str, FILE *stream) * The message must be metafied. */ /**/ -void mod_export +mod_export void showmsg(char const *msg) { char const *p; diff --git a/Util/check_exports b/Util/check_exports new file mode 100755 index 000000000..7b56d3015 --- /dev/null +++ b/Util/check_exports @@ -0,0 +1,64 @@ +#!/usr/local/bin/perl -w + +# Attempt to scan executable, libraries, and .export files after +# a zsh build to see if all necessary symbols appear in the .export file +# (and hence with `mod_export' in the source file). This keeps AIX happy. +# Probably severely system dependent, but known to run on Fedora Core 1, +# at least. Not needed on AIX itself... you can tell if doesn't link. + +if (! -f "zsh") { + die "Can't file zsh, are we in the Src directory of the build?\n"; +} + +my (%defined, %undefined, %exported); + +foreach my $file ("zsh", glob("*.so */*.so")) { + next unless -f $file; + + my $exports = $file; + $exports =~ s/\.so//; + $exports .= ".export"; + if (-f $exports) { + open EXPORT, $exports or die "Can't read $exports: $!\n"; + my $href = $exported{$file} = { }; + while () { + next if /^#/; + chomp; + $href->{$_} = 1; + } + close EXPORT; + } else { + warn "Hmmm... no .exports file for $file\n"; + } + + open PIPE, "nm $file |" or die "Can't popen nm"; + while () { + s/^[0-9a-f]*\s+//; + my ($type, $sym) = split; + # ignore local symbols (lower case) + if ($type =~ /^[TBAD]/) { + if (!defined $defined{$sym}) { + $defined{$sym} = $file; + } + } elsif ($type eq 'U') { + # could skip undefined from zsh and zsh.so, but what the heck + my $ref = \$undefined{$sym}; + if (defined $$ref) { + push @$$ref, $file; + } else { + $$ref = [ $file ]; + } + } + } + close PIPE or die "nm failed"; +} + +foreach $sym (keys %undefined) { + my $deffile = $defined{$sym}; + if (defined $deffile) { + if (!$exported{$deffile}{$sym}) { + printf "%-20s: %-20s: %s\n", $sym, $defined{$sym}, + join(" ", @{$undefined{$sym}}); + } + } +}