1DOLLY 72PACKAGE stack-wrap3REQUIRES HOST runtime@045678FROM /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-wrap1617FILE /tmp/stack-wrap/deep.c1819 __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