From d879fb6a28b23171784d06846d4850beb583a655 Mon Sep 17 00:00:00 2001 From: Chen Zheng Date: Sun, 4 Aug 2024 23:32:05 -0400 Subject: [PATCH 1/3] [AIX]export function descriptor symbols related to template funcionts. --- llvm/utils/extract_symbols.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 10fdf14acd158..19a3066deec73 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -484,5 +484,9 @@ def parse_tool_path(parser, tool, val): outfile = sys.stdout for k, v in list(symbol_defs.items()): template = get_template_name(k, args.mangling) + # On AIX, "template" functions starting with "_" are actually function + # descriptors which are data symbols. Export these data symbols. + if template and platform.system() == "AIX" and k.startswith("_"): + template = None if v == 1 and (not template or template in template_instantiation_refs): print(k, file=outfile) From cfc464425015fa62d5b983ebf9571c282fdbc9c7 Mon Sep 17 00:00:00 2001 From: Chen Zheng Date: Mon, 5 Aug 2024 21:57:53 -0400 Subject: [PATCH 2/3] address comments --- llvm/utils/extract_symbols.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 19a3066deec73..7fb77f458c5ab 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -140,7 +140,7 @@ def should_keep_itanium_symbol(symbol, calling_convention_decoration): if not symbol.startswith("_") and not symbol.startswith("."): return symbol # Discard manglings that aren't nested names - match = re.match("_Z(T[VTIS])?(N.+)", symbol) + match = re.match("\.?_Z(T[VTIS])?(N.+)", symbol) if not match: return None # Demangle the name. If the name is too complex then we don't need to keep @@ -323,7 +323,7 @@ def get_template_name(sym, mangling): if mangling == "microsoft": names = parse_microsoft_mangling(sym) else: - match = re.match("_Z(T[VTIS])?(N.+)", sym) + match = re.match("\.?_Z(T[VTIS])?(N.+)", sym) if match: names, _ = parse_itanium_nested_name(match.group(2)) else: @@ -483,10 +483,9 @@ def parse_tool_path(parser, tool, val): else: outfile = sys.stdout for k, v in list(symbol_defs.items()): + # On AIX, export function descriptors instead of function entries. + if platform.system() == "AIX" and k.startswith("."): + continue template = get_template_name(k, args.mangling) - # On AIX, "template" functions starting with "_" are actually function - # descriptors which are data symbols. Export these data symbols. - if template and platform.system() == "AIX" and k.startswith("_"): - template = None if v == 1 and (not template or template in template_instantiation_refs): print(k, file=outfile) From 2a06804a9d5347466539743accf7c1e47ff26657 Mon Sep 17 00:00:00 2001 From: Chen Zheng Date: Mon, 5 Aug 2024 22:07:59 -0400 Subject: [PATCH 3/3] format fix --- llvm/utils/extract_symbols.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 7fb77f458c5ab..684e124c76259 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -485,7 +485,7 @@ def parse_tool_path(parser, tool, val): for k, v in list(symbol_defs.items()): # On AIX, export function descriptors instead of function entries. if platform.system() == "AIX" and k.startswith("."): - continue + continue template = get_template_name(k, args.mangling) if v == 1 and (not template or template in template_instantiation_refs): print(k, file=outfile)