Skip to content

Commit cb5ebf7

Browse files
Chen Zhengllvmbot
Chen Zheng
authored andcommitted
[AIX]export function descriptor symbols related to template functions. (llvm#101920)
This fixes regressions caused by llvm#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 396343f)
1 parent d033ae1 commit cb5ebf7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/utils/extract_symbols.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def should_keep_itanium_symbol(symbol, calling_convention_decoration):
140140
if not symbol.startswith("_") and not symbol.startswith("."):
141141
return symbol
142142
# Discard manglings that aren't nested names
143-
match = re.match("_Z(T[VTIS])?(N.+)", symbol)
143+
match = re.match("\.?_Z(T[VTIS])?(N.+)", symbol)
144144
if not match:
145145
return None
146146
# 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):
323323
if mangling == "microsoft":
324324
names = parse_microsoft_mangling(sym)
325325
else:
326-
match = re.match("_Z(T[VTIS])?(N.+)", sym)
326+
match = re.match("\.?_Z(T[VTIS])?(N.+)", sym)
327327
if match:
328328
names, _ = parse_itanium_nested_name(match.group(2))
329329
else:
@@ -483,6 +483,9 @@ def parse_tool_path(parser, tool, val):
483483
else:
484484
outfile = sys.stdout
485485
for k, v in list(symbol_defs.items()):
486+
# On AIX, export function descriptors instead of function entries.
487+
if platform.system() == "AIX" and k.startswith("."):
488+
continue
486489
template = get_template_name(k, args.mangling)
487490
if v == 1 and (not template or template in template_instantiation_refs):
488491
print(k, file=outfile)

0 commit comments

Comments
 (0)