Skip to content

Commit

Permalink
[extract_symbols.py] Be more permissive when examining nm output
Browse files Browse the repository at this point in the history
The regex which checks for undefined symbols in the nm output was
written assuming GNU nm, but other versions of nm (e.g. llvm-nm) have
slightly different output. Make the regex more permissive to account
for this.
  • Loading branch information
john-brawn-arm committed Feb 13, 2023
1 parent 8f5d815 commit e5d9146
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/utils/extract_symbols.py
Expand Up @@ -62,8 +62,9 @@ def nm_get_symbols(lib):
match = re.match("^(\S+)\s+[^AU]\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).
match = re.match("^(\S+)\s+U\s+$", line)
# Look for undefined symbols, which have type U and may or may not
# (depending on which nm is being used) have value and size.
match = re.match("^(\S+)\s+U\s+(\S+\s+\S*)?$", line)
if match:
yield (match.group(1), False)
process.wait()
Expand Down

0 comments on commit e5d9146

Please sign in to comment.