use strict;
+my $verbose=0;
+
my %definers;
my %reqsyms;
my %reqmods;
open DEPENDS,">modules.dep";
open GRAPH,">modgraph.dot";
+if (@ARGV) {
+ if ($ARGV[0] eq "--verbose" or $ARGV[0] eq "-v") {
+ $verbose=1;
+ }
+}
+
for (@arglist) {
my $modname=$_;
open NM,"nm $modname |";
next if ($sym eq "_init");
next if ($sym eq "_fini");
next if ($sym eq "_version");
+ next if ($sym eq "__bss_start");
+ next if ($sym eq "_end");
if ($type eq "U") {
push @{$reqsyms{$modname}}, $sym;
if (defined $provider) {
${reqmods{$modname}}{$provider}=1;
+ if ($verbose) {
+ print "Module $modname importing $_ from $provider\n";
+ }
}
}
}
print DEPENDS "$modname";
for (keys %{$reqmods{$modname}}) {
+ if (defined ${$reqmods{$_}}{$modname}) {
+ print "ERROR: circular dependency between $modname and $_\n";
+ }
print DEPENDS " $_";
print GRAPH "\t\"$modname\" -> \"$_\";\n";
}