1DOLLY 82PACKAGE stack-wrap3REQUIRES HOST runtime@04REQUIRES HOST stack@056789FROM /Dollyfile-system-build 0c72e09eba84571d4f8634cf6e7507eb1be1b9b8aa1fae61f6b0ec884b26b6fb10REQUIRES HEADER libc11REQUIRES TOOL cc12REQUIRES TOOL rm1314SOURCE /host/stack/stack-abi.h 220793655506ef3b506ea83f1cd50afeb3f4517f6e47a8d9a3baa3558a2a9c08 /tmp/stack-wrap/dolly/stack-abi.h15SOURCE /host/stack/stack-wrap.c 408da54d01388d0a1c18d941719b4ab7e02c9f22e295365ebd86fba2f3a65c14 /tmp/stack-wrap/stack-wrap.c16SLOP cc -O2 -I/tmp/stack-wrap /tmp/stack-wrap/stack-wrap.c -o /usr/bin/stack-wrap1718FILE /tmp/stack-wrap/deep.c1920 __attribute__((noinline)) static unsigned long fold(unsigned long n) {21 if (n == 0) return 0;22 unsigned long below = fold(n - 1);23 return below ^ (below >> 3) ^ n;24 }25 int main(int argc, char **argv) {26 unsigned long n = strtoul(argv[1], NULL, 10), expected = 0;27 for (unsigned long step = 1; step <= n; ++step) expected ^= (expected >> 3) ^ step;28 return fold(n) != expected;29 }30SLOP CWD /tmp/stack-wrap cc -O2 deep.c -o plain && stack-wrap plain -o deep && ./deep 20000031SLOP rm -rf /tmp/stack-wrap3233EXPORTS TOOL stack-wrap34FILE /usr/share/man/cat1/stack-wrap.135 stack-wrap IN -o OUT: rewrites a linked program so that it recurses deeper36 than one browser stack. Each function that makes calls charges its frame37 on entry; with too little room left it continues on a fresh stack.38 39 The program then records stack@0: an image that holds it declares40 REQUIRES HOST stack@0. A function that makes a tail call, debug41 information and unlinked objects are refused.42