]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Allow lines without a symbol
authorSimon Glass <sjg@chromium.org>
Tue, 12 Jul 2022 01:04:11 +0000 (19:04 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 5 Aug 2022 15:47:56 +0000 (11:47 -0400)
The 'nm' tool can produce lines without a symbol, for example:

   00000004 t

Silently skip these and anything else without three fields. Drop the
warning since there is nothing the user can do about it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
tools/buildman/builder.py

index 33f9373b8f8ac6b389a91ac030331528fd9c866e..76252b90792a6c64f20c5b700efbe0ce6d801ef3 100644 (file)
@@ -669,17 +669,15 @@ class Builder:
         """
         sym = {}
         for line in fd.readlines():
-            try:
-                if line.strip():
-                    size, type, name = line[:-1].split()
-            except:
-                tprint("Invalid line in file '%s': '%s'" % (fname, line[:-1]))
-                continue
-            if type in 'tTdDbB':
-                # function names begin with '.' on 64-bit powerpc
-                if '.' in name[1:]:
-                    name = 'static.' + name.split('.')[0]
-                sym[name] = sym.get(name, 0) + int(size, 16)
+            line = line.strip()
+            parts = line.split()
+            if line and len(parts) == 3:
+                    size, type, name = line.split()
+                    if type in 'tTdDbB':
+                        # function names begin with '.' on 64-bit powerpc
+                        if '.' in name[1:]:
+                            name = 'static.' + name.split('.')[0]
+                        sym[name] = sym.get(name, 0) + int(size, 16)
         return sym
 
     def _ProcessConfig(self, fname):