Bug 1336791 - Allow readelf to print types without parentheses. r?glandium draft
authorJan Beich <jbeich@FreeBSD.org>
Sun, 05 Feb 2017 10:57:06 +0000
changeset 479838 5a33b4de287747f45b13c00526ff970c71959ec7
parent 479651 af8a2573d0f1e9cc6f2ba0ab67d7a702a197f177
child 544803 842649f403796e8a420f5d99f79c6984a45bfcfe
push id44381
push userbmo:jbeich@FreeBSD.org
push dateTue, 07 Feb 2017 10:56:35 +0000
reviewersglandium
bugs1336791
milestone54.0a1
Bug 1336791 - Allow readelf to print types without parentheses. r?glandium MozReview-Commit-ID: 28Jhay1mYMM
toolkit/library/dependentlibs.py
--- a/toolkit/library/dependentlibs.py
+++ b/toolkit/library/dependentlibs.py
@@ -52,21 +52,25 @@ def dependentlibs_mingw_objdump(lib):
 
 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)
     deps = []
     for line in proc.stdout:
         # Each line has the following format:
         #  tag (TYPE)          value
+        # or with BSD readelf:
+        #  tag TYPE            value
         # Looking for NEEDED type entries
         tmp = line.split(' ', 3)
-        if len(tmp) > 3 and tmp[2] == '(NEEDED)':
+        if len(tmp) > 3 and 'NEEDED' in tmp[2]:
             # NEEDED lines look like:
             # 0x00000001 (NEEDED)             Shared library: [libname]
+            # or with BSD readelf:
+            # 0x00000001 NEEDED               Shared library: [libname]
             match = re.search('\[(.*)\]', tmp[3])
             if match:
                 deps.append(match.group(1))
     proc.wait()
     return deps
 
 def dependentlibs_otool(lib):
     '''Returns the list of dependencies declared in the given MACH-O dylib'''