summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 12:03:39 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-12 12:03:39 -0700
commit76cef6c7dd3c42f1511486800760d78357624edc (patch)
tree6048ce56841b3a0ed4afad42cfb43fe3372f220c /build-aux
parenta0386a75584842d01b312d8c6990857c85fb0d65 (diff)
libdhcp: Reduce stack use
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/stack.c.gen6
1 files changed, 6 insertions, 0 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index ae05a78..97775a6 100755
--- a/build-aux/stack.c.gen
+++ b/build-aux/stack.c.gen
@@ -209,7 +209,10 @@ def main(ci_fnames: list[str]) -> None:
print("/*")
+ dbg = False
+
def nstatic(funcname: str, chain: list[str] = []) -> int:
+ nonlocal dbg
if funcname not in graph:
if f"__wrap_{funcname}" in graph:
# Handle `ld --wrap` functions
@@ -224,6 +227,8 @@ def main(ci_fnames: list[str]) -> None:
cycles.add(f"{chain[chain.index(funcname):] + [funcname]}")
return 9999999
node = graph[funcname]
+ if dbg:
+ print(f"//dbg: {funcname}\t{node.nstatic}")
return node.nstatic + max(
[0, *[nstatic(call, chain + [funcname]) for call in node.calls]]
)
@@ -234,6 +239,7 @@ def main(ci_fnames: list[str]) -> None:
for funcname in graph:
if funcname.endswith("_cr"):
+ # dbg = "dhcp" in funcname
print(f"{funcname.ljust(namelen)} {str(nstatic(funcname)).rjust(numlen)}")
print(("=" * namelen) + " " + "=" * numlen)