1DOLLY 72PACKAGE stack-wrap3REQUIRES HOST runtime@045# stack-wrap, which makes a program continue deep recursion on fresh browser6# stacks (host/stack, docs/browser-stack.md). A program it has rewritten7# records stack@0, which an image that holds one declares.8FROM /v0.1.5/Dollyfile-system-build cf9cf053fb5debc080062e6e44c1b139175739f6158fa8a825b0255ba2063aee9REQUIRES HEADER libc10REQUIRES TOOL cc11REQUIRES TOOL rm1213SOURCE /v0.1.5/host/stack/stack-abi.h 220793655506ef3b506ea83f1cd50afeb3f4517f6e47a8d9a3baa3558a2a9c08 /tmp/stack-wrap/dolly/stack-abi.h14SOURCE /v0.1.5/host/stack/stack-wrap.c 408da54d01388d0a1c18d941719b4ab7e02c9f22e295365ebd86fba2f3a65c14 /tmp/stack-wrap/stack-wrap.c15SLOP cc -O2 -I/tmp/stack-wrap /tmp/stack-wrap/stack-wrap.c -o /usr/bin/stack-wrap16# A program it rewrote recurses deeper than one browser stack, in a build too.17FILE /tmp/stack-wrap/deep.c18    #include <stdlib.h>19    __attribute__((noinline)) static unsigned long fold(unsigned long n) {20      if (n == 0) return 0;21      unsigned long below = fold(n - 1);22      return below ^ (below >> 3) ^ n;23    }24    int main(int argc, char **argv) {25      unsigned long n = strtoul(argv[1], NULL, 10), expected = 0;26      for (unsigned long step = 1; step <= n; ++step) expected ^= (expected >> 3) ^ step;27      return fold(n) != expected;28    }29SLOP CWD /tmp/stack-wrap cc -O2 deep.c -o plain && stack-wrap plain -o deep && ./deep 20000030SLOP rm -rf /tmp/stack-wrap3132EXPORTS TOOL stack-wrap33FILE /usr/share/man/cat1/stack-wrap.134    stack-wrap IN -o OUT: rewrites a linked program so that it recurses deeper35    than one browser stack. Each function that makes calls charges its frame36    on entry; with too little room left it continues on a fresh stack.37    38    The program then records stack@0: an image that holds it declares39    REQUIRES HOST stack@0. A function that makes a tail call, debug40    information and unlinked objects are refused.41