[llvm-commits] [llvm] r57057 - /llvm/trunk/utils/GenLibDeps.pl

Chris Lattner sabre at nondot.org
Sat Oct 4 11:03:46 PDT 2008


Author: lattner
Date: Sat Oct  4 13:03:46 2008
New Revision: 57057

URL: http://llvm.org/viewvc/llvm-project?rev=57057&view=rev
Log:
Make GenLibDeps.pl more robust in the face of broken piping problems.
Patch by Kenneth Boyd!

Modified:
    llvm/trunk/utils/GenLibDeps.pl

Modified: llvm/trunk/utils/GenLibDeps.pl
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/GenLibDeps.pl?rev=57057&r1=57056&r2=57057&view=diff

==============================================================================
--- llvm/trunk/utils/GenLibDeps.pl (original)
+++ llvm/trunk/utils/GenLibDeps.pl Sat Oct  4 13:03:46 2008
@@ -114,6 +114,32 @@
     }
   }
   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";





More information about the llvm-commits mailing list