[llvm-branch-commits] [llvm] release/19.x: [AIX]export function descriptor symbols related to template functions. (#101920) (PR #102407)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 7 18:12:07 PDT 2024
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/102407
Backport 396343f17b1182ff8ed698beac3f9b93b1d9dabd
Requested by: @chenzheng1030
>From cb5ebf74d17c47392a41b12bc44b572f2f046979 Mon Sep 17 00:00:00 2001
From: Chen Zheng <czhengsz at cn.ibm.com>
Date: Tue, 6 Aug 2024 11:07:45 +0800
Subject: [PATCH] [AIX]export function descriptor symbols related to template
functions. (#101920)
This fixes regressions caused by
https://github.com/llvm/llvm-project/pull/97526
After that patch, all undefined references to DS symbol are removed.
This makes DS symbols(for template functions) have no reference in some
cases. So extract_symbols.py does not export these DS symbols for these
cases.
On AIX, exporting the function descriptor depends on references to the
function descriptor itself and the function entry symbol.
Without this fix, on AIX, we get:
```
rtld: 0712-001 Symbol _ZN4llvm15SmallVectorBaseIjE13mallocForGrowEPvmmRm was referenced
from module llvm-project/build/unittests/Passes/Plugins/TestPlugin.so(), but a runtime definition
of the symbol was not found.
```
(cherry picked from commit 396343f17b1182ff8ed698beac3f9b93b1d9dabd)
---
llvm/utils/extract_symbols.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py
index 10fdf14acd1586..684e124c762594 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,6 +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)
if v == 1 and (not template or template in template_instantiation_refs):
print(k, file=outfile)
More information about the llvm-branch-commits
mailing list