Bug 1471293 - Support using llvm-objdump in dependentlibs.py r?glandium draft
authorJacek Caban <jacek@codeweavers.com>
Tue, 26 Jun 2018 15:15:19 +0200
changeset 810872 3c594cca8c20006879fad5227d9837da33888808
parent 810739 70b718b34a5105fd250f36350b10ee2be6dc9c16
child 810899 d92b9870a9fb50abd3f7deb7f07f9cc2b7fb10cc
push id114144
push userbmo:jacek@codeweavers.com
push dateTue, 26 Jun 2018 17:10:39 +0000
reviewersglandium
bugs1471293
milestone63.0a1
Bug 1471293 - Support using llvm-objdump in dependentlibs.py r?glandium MozReview-Commit-ID: 8b0o06EQh3n
toolkit/library/dependentlibs.py
--- a/toolkit/library/dependentlibs.py
+++ b/toolkit/library/dependentlibs.py
@@ -36,20 +36,24 @@ def dependentlibs_dumpbin(lib):
              # There may be several groups of library names, but only the
              # first one is interesting. The second one is for delayload-ed
              # libraries.
              break
     proc.wait()
     return deps
 
 def dependentlibs_mingw_objdump(lib):
-    proc = subprocess.Popen(['objdump', '-x', lib], stdout = subprocess.PIPE)
+    try:
+        proc = subprocess.Popen(['objdump', '-x', lib], stdout = subprocess.PIPE)
+    except OSError:
+        # objdump is missing, try using llvm-objdump.
+        proc = subprocess.Popen(['llvm-objdump', '-private-headers', lib], stdout = subprocess.PIPE)
     deps = []
     for line in proc.stdout:
-        match = re.match('\tDLL Name: (\S+)', line)
+        match = re.match('\s+DLL Name: (\S+)', line)
         if match:
             deps.append(match.group(1))
     proc.wait()
     return deps
 
 def dependentlibs_readelf(lib):
     '''Returns the list of dependencies declared in the given ELF .so'''
     proc = subprocess.Popen([substs.get('TOOLCHAIN_PREFIX', '') + 'readelf', '-d', lib], stdout = subprocess.PIPE)