1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Use portable flag with nm in extract_symbols.py

Summary:
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.

A link to the relevant nm format: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html

Reviewers: hubert.reinterpretcast, stevewan, sfertile

Reviewed By: stevewan

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69004
This commit is contained in:
David Tenty 2019-10-23 16:48:02 -04:00
parent e95503bd4f
commit 1ecd800968

View File

@ -42,13 +42,13 @@ def dumpbin_get_symbols(lib):
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()