[llvm] a09e93b - [AIX] Include symbol alias in extract_symbols.py

Jinsong Ji via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 18:38:11 PDT 2021


Author: Jinsong Ji
Date: 2021-07-30T01:37:56Z
New Revision: a09e93bfb820a261e009422cae53134578274500

URL: https://github.com/llvm/llvm-project/commit/a09e93bfb820a261e009422cae53134578274500
DIFF: https://github.com/llvm/llvm-project/commit/a09e93bfb820a261e009422cae53134578274500.diff

LOG: [AIX] Include symbol alias in extract_symbols.py

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

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D107112

Added: 
    

Modified: 
    llvm/utils/extract_symbols.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py
index 43f603963a20..6f01cd12fcd8 100755
--- a/llvm/utils/extract_symbols.py
+++ b/llvm/utils/extract_symbols.py
@@ -53,7 +53,12 @@ def nm_get_symbols(lib):
     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()


        


More information about the llvm-commits mailing list