aboutsummaryrefslogtreecommitdiff
path: root/utils/GenLibDeps.pl
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-05-13 02:48:45 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-05-13 02:48:45 +0000
commitdd73e7fa0950fa0244ab97984347cb442d553ff0 (patch)
tree3ce2ab1382e0dc9da5093c20e9bc1070d33062df /utils/GenLibDeps.pl
parentd42037abd71c10e7aa8501c171ecfe2d268dd781 (diff)
Don't try to reference uninitialized data. Make sure we can find "nm".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/GenLibDeps.pl')
-rwxr-xr-xutils/GenLibDeps.pl12
1 files changed, 8 insertions, 4 deletions
diff --git a/utils/GenLibDeps.pl b/utils/GenLibDeps.pl
index 6f0b82fd67..ee8cc7aa2a 100755
--- a/utils/GenLibDeps.pl
+++ b/utils/GenLibDeps.pl
@@ -23,11 +23,15 @@ while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) {
my $Directory = $ARGV[0];
# Find the "dot" program
+my $DotPath="";
if (!$FLAT) {
- chomp(my $DotPath = `which dot`);
+ chomp($DotPath = `which dot`);
die "Can't find 'dot'" if (! -x "$DotPath");
}
+chomp(my $nmPath=`which nm`);
+die "Can't find 'nm'" if (! -x "$nmPath");
+
# Open the directory and read its contents, sorting by name and differentiating
# by whether its a library (.a) or an object file (.o)
opendir DIR,$Directory;
@@ -44,7 +48,7 @@ my %objdefs;
# Gather definitions from the libraries
foreach $lib (@libs ) {
open DEFS,
- "nm -g $Directory/$lib | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |";
+ "$nmPath -g $Directory/$lib | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |";
while (<DEFS>) {
chomp($_);
$libdefs{$_} = $lib;
@@ -55,7 +59,7 @@ foreach $lib (@libs ) {
# Gather definitions from the object files.
foreach $obj (@objs ) {
open DEFS,
- "nm -g $Directory/$obj | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |";
+ "$nmPath -g $Directory/$obj | grep ' [ABCDGRST] ' | sed -e 's/^[0-9A-Fa-f]* [ABCDGRST] //' | sort | uniq |";
while (<DEFS>) {
chomp($_);
$objdefs{$_} = $obj;
@@ -76,7 +80,7 @@ sub gen_one_entry {
print " <dt><b>$lib</b</dt><dd><ul>\n";
}
open UNDEFS,
- "nm -g -u $Directory/$lib | sed -e 's/^ *U //' | sort | uniq |";
+ "$nmPath -g -u $Directory/$lib | sed -e 's/^ *U //' | sort | uniq |";
open DEPENDS,
"| sort | uniq > GenLibDeps.out";
while (<UNDEFS>) {