summaryrefslogtreecommitdiff
path: root/utils/GenLibDeps.pl
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-04 18:03:46 +0000
committerChris Lattner <sabre@nondot.org>2008-10-04 18:03:46 +0000
commit8d59af356f68fa960cb3e69551d5a8b87d6a71b0 (patch)
tree7ee2663f6b0e78b4a81bf5978fe896b7fe49ec34 /utils/GenLibDeps.pl
parentc82b6a1ed2496ce0d61d2e51ed3a4cac4db786da (diff)
downloadllvm-8d59af356f68fa960cb3e69551d5a8b87d6a71b0.tar.gz
llvm-8d59af356f68fa960cb3e69551d5a8b87d6a71b0.tar.bz2
llvm-8d59af356f68fa960cb3e69551d5a8b87d6a71b0.tar.xz
Make GenLibDeps.pl more robust in the face of broken piping problems.
Patch by Kenneth Boyd! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/GenLibDeps.pl')
-rwxr-xr-xutils/GenLibDeps.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/GenLibDeps.pl b/utils/GenLibDeps.pl
index 35811b4e3c..21853d5350 100755
--- a/utils/GenLibDeps.pl
+++ b/utils/GenLibDeps.pl
@@ -114,6 +114,32 @@ sub gen_one_entry {
}
}
close UNDEFS;
+ unless(keys %DepLibs) {
+ # above failed
+ open UNDEFS, "$nmPath -g -u $Directory/$lib |";
+ while (<UNDEFS>) {
+ # to bypass non-working sed
+ if (' ' eq substr($_,0,2) and index($_,'U ')) {
+ $_ = substr($_,index($_,'U ')+2)
+ };
+ $_ = substr($_,index($_,' *U ')+5) if -1!=index($_,' *U ');
+
+ chomp;
+ my $lib_printed = 0;
+ if (defined($libdefs{$_}) && $libdefs{$_} ne $lib) {
+ $DepLibs{$libdefs{$_}} = [] unless exists $DepLibs{$libdefs{$_}};
+ push(@{$DepLibs{$libdefs{$_}}}, $_);
+ } elsif (defined($objdefs{$_}) && $objdefs{$_} ne $lib) {
+ my $libroot = $lib;
+ $libroot =~ s/lib(.*).a/$1/;
+ if ($objdefs{$_} ne "$libroot.o") {
+ $DepLibs{$objdefs{$_}} = [] unless exists $DepLibs{$objdefs{$_}};
+ push(@{$DepLibs{$objdefs{$_}}}, $_);
+ }
+ }
+ }
+ }
+
for my $key (sort keys %DepLibs) {
if ($FLAT) {
print " $key";