summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/stack.c.gen19
1 files changed, 15 insertions, 4 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index 5e7bd7e..80bea85 100755
--- a/build-aux/stack.c.gen
+++ b/build-aux/stack.c.gen
@@ -176,15 +176,24 @@ def main(ci_fnames: list[str]) -> None:
handle_elem(elem)
missing: set[str] = set()
+ cycles: set[str] = set()
print("/*")
- def nstatic(funcname: str) -> int:
+ def nstatic(funcname: str, chain: list[str] = []) -> int:
if funcname not in graph:
- missing.add(funcname)
- return 0
+ if f"__wrap_{funcname}" in graph:
+ funcname = f"__wrap_{funcname}"
+ else:
+ missing.add(funcname)
+ return 0
+ if funcname in chain:
+ cycles.add(f"{chain[chain.index(funcname):] + [funcname]}")
+ return 9999999
node = graph[funcname]
- return node.nstatic + max([0, *[nstatic(call) for call in node.calls]])
+ return node.nstatic + max(
+ [0, *[nstatic(call, chain + [funcname]) for call in node.calls]]
+ )
namelen = max(len(name) for name in graph if name.endswith("_cr"))
print(("=" * namelen) + " =======")
@@ -197,6 +206,8 @@ def main(ci_fnames: list[str]) -> None:
for funcname in sorted(missing):
print(f"{funcname}\tmissing")
+ for cycle in sorted(cycles):
+ print(f"cycle: {cycle}")
print("*/")