From 78f13ea093afdebcaa3b5c5690530b9217bbdfac Mon Sep 17 00:00:00 2001 From: John Brawn Date: Fri, 10 Feb 2023 14:51:54 +0000 Subject: [PATCH] [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. --- llvm/utils/extract_symbols.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index f64e3d1..7270f59 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). -- 2.7.4