[PATCH] D69004: Use portable flag with nm in extract_symbols.py

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 13:46:41 PDT 2019


daltenty created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
daltenty added a reviewer: hubert.reinterpretcast.

nm is one of the tools that extract_symbols.py can use to extract
symbols from llvm libraries as part of the build process. This patch
updates the invocation of nm to use the -P POSIX option for "portable
output" so we get a consistently parsable output format on all
platforms.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69004

Files:
  llvm/utils/extract_symbols.py


Index: llvm/utils/extract_symbols.py
===================================================================
--- llvm/utils/extract_symbols.py
+++ llvm/utils/extract_symbols.py
@@ -42,13 +42,13 @@
     process.wait()
 
 def nm_get_symbols(lib):
-    process = subprocess.Popen(['nm',lib], bufsize=1,
+    process = subprocess.Popen(['nm','-P',lib], bufsize=1,
                                stdout=subprocess.PIPE, stdin=subprocess.PIPE,
                                universal_newlines=True)
     process.stdin.close()
     for line in process.stdout:
         # Look for external symbols that are defined in some section
-        match = re.match("^\S+\s+[BDGRSTVW]\s+(\S+)$", line)
+        match = re.match("^(\S+)\s+[BDGRSTVW]\s+\S+\s+\S+$", line)
         if match:
             yield match.group(1)
     process.wait()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69004.225109.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191015/8512b0fe/attachment.bin>


More information about the llvm-commits mailing list