summary refs log tree commit diff stats
path: root/scripts/undefsym.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-10-20 05:18:17 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-10-22 11:53:52 -0400
commitda0dfe251d7216ffbee72c7e0ae0709ba9b422e6 (patch)
tree8f626aead72a2596c7a597b50ea420a3c67c3db5 /scripts/undefsym.py
parent4c5b97bfd0dd54dc27717ae8d1cd10e14eef1430 (diff)
downloadfocaccia-qemu-da0dfe251d7216ffbee72c7e0ae0709ba9b422e6.tar.gz
focaccia-qemu-da0dfe251d7216ffbee72c7e0ae0709ba9b422e6.zip
build: fix macOS --enable-modules build
Apple's nm implementation includes empty lines in the output that are not
found in GNU binutils.  This confuses scripts/undefsym.py, though it did
not confuse the scripts/undefsym.sh script that it replaced.  To fix
this, ignore lines that do not have two fields.

Reported-by: Emmanuel Blot <eblot.ml@gmail.com>
Tested-by: Emmanuel Blot <eblot.ml@gmail.com>
Fixes: 604f3e4e90 ("meson: Convert undefsym.sh to undefsym.py", 2020-09-08)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts/undefsym.py')
-rw-r--r--scripts/undefsym.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/undefsym.py b/scripts/undefsym.py
index 69a895cd26..4b6a72d95f 100644
--- a/scripts/undefsym.py
+++ b/scripts/undefsym.py
@@ -15,12 +15,11 @@ def filter_lines_set(stdout, from_staticlib):
     linesSet = set()
     for line in stdout.splitlines():
         tokens = line.split(b' ')
-        if len(tokens) >= 1:
-            if len(tokens) > 1:
-                if from_staticlib and tokens[1] == b'U':
-                    continue
-                if not from_staticlib and tokens[1] != b'U':
-                    continue
+        if len(tokens) >= 2:
+            if from_staticlib and tokens[1] == b'U':
+                continue
+            if not from_staticlib and tokens[1] != b'U':
+                continue
             new_line = b'-Wl,-u,' + tokens[0]
             if not new_line in linesSet:
                 linesSet.add(new_line)