[PATCH 17/19] buildman: Allow lines without a symbol

Simon Glass sjg at chromium.org
Tue Jul 12 03:04:11 CEST 2022


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 at chromium.org>
Reported-by: Tom Rini <trini at konsulko.com>
---

 tools/buildman/builder.py | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 33f9373b8f8..76252b90792 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -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):
-- 
2.37.0.144.g8ac04bfd2-goog



More information about the U-Boot mailing list