[llvm] 78f13ea - [extract_symbols.py] Adjust how the output of nm is interpreted
John Brawn via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 10 07:55:54 PST 2023
Author: John Brawn
Date: 2023-02-10T15:55:45Z
New Revision: 78f13ea093afdebcaa3b5c5690530b9217bbdfac
URL: https://github.com/llvm/llvm-project/commit/78f13ea093afdebcaa3b5c5690530b9217bbdfac
DIFF: https://github.com/llvm/llvm-project/commit/78f13ea093afdebcaa3b5c5690530b9217bbdfac.diff
LOG: [extract_symbols.py] Adjust how the output of nm is interpreted
When looking for defined symbols, look for symbols that aren't of a
type that we don't want, instead of having specific list of symbol
types that we do want. This fixes a problem where (when using GNU
nm at least) there were some symbol types that we want to export but
which weren't in the list.
Added:
Modified:
llvm/utils/extract_symbols.py
Removed:
################################################################################
diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py
index f64e3d1eebb9..7270f59ec0d5 100755
--- a/llvm/utils/extract_symbols.py
+++ b/llvm/utils/extract_symbols.py
@@ -52,13 +52,14 @@ def nm_get_symbols(lib):
universal_newlines=True)
process.stdin.close()
for line in process.stdout:
- # Look for external symbols that are defined in some section
+ # Look for external symbols that are defined in some section, i.e.
+ # symbols that aren't absolute, local, or undefined.
# The POSIX format is:
# name type value size
# The -P flag displays the size field for symbols only when applicable,
# so the last field is optional. There's no space after the value field,
# but \s+ match newline also, so \s+\S* will match the optional size field.
- match = re.match("^(\S+)\s+[BDGRSTVW]\s+\S+\s+\S*$", line)
+ match = re.match("^(\S+)\s+[^AabdtU]\s+\S+\s+\S*$", line)
if match:
yield (match.group(1), True)
# Look for undefined symbols, which have only name and type (which is U).
More information about the llvm-commits
mailing list