Apparently, somebody's been playing around with ELF sections again, and
my nm didn't grok it.
Here's an updated version of the script.
#! /usr/bin/perl -w
use File::Find;
$basedir = '/usr/src/linux/';
$maxlen = 0;
chdir $basedir;
find(\&wanted, $basedir);
for (keys %defined)
{
foreach $oname (@{$defined{$_}}) {
$oname =~ s/.o$//;
$cfilename = "$oname.c";
$sfilename = "$oname.S";
next if $req{$_};
$offending_file = "";
if (-f $cfilename) {
$offending_file = $cfilename;
}
elsif (-f $sfilename) {
$offending_file = $sfilename;
}
else {
next;
}
$maxlen = length($offending_file) if length($offending_file) > $maxlen;
push(@{$found{$offending_file}}, $_);
}
}
for (sort keys %found)
{
printf ("%-".$maxlen. "s: ",$_);
print (join(', ', sort (@{$found{$_}})),"\n");
}
sub wanted {
my($tmp) = $_;
my($name, $foo);
my(@fld);
return undef if !/^.*\.o$/;
return undef if $File::Find::dir =~ /scripts/;
$name = $File::Find::name;
open(NM,"nm --extern-only $name|");
while(<NM>) {
@fld = split(/\s+/);
if ($fld[1] eq "U") {
$req{$fld[2]} ++;
}
elsif ($fld[1] ne "?") {
$foo = $name;
$foo =~ s/$basedir//;
push(@{$defined{$fld[2]}}, $foo);
}
}
close(NM);
$_ = $tmp;
};
-- Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet. The joy of engineering is to find a straight line on a double logarithmic diagram.