[PATCH] D107112: [AIX] Include symbol alias in extract_symbols.py

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 15:10:40 PDT 2021


jsji created this revision.
jsji added reviewers: PowerPC, daltenty, hubert.reinterpretcast.
Herald added a subscriber: jeroen.dobbelaere.
jsji requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

nm does not show size for aliased symbols,
we should still extract them if they are external.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107112

Files:
  llvm/utils/extract_symbols.py


Index: llvm/utils/extract_symbols.py
===================================================================
--- llvm/utils/extract_symbols.py
+++ llvm/utils/extract_symbols.py
@@ -53,7 +53,12 @@
     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+\s+\S+$", line)
+        # 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)
         if match:
             yield match.group(1)
     process.wait()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107112.362898.patch
Type: text/x-patch
Size: 851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210729/261fe78b/attachment.bin>


More information about the llvm-commits mailing list