xref: /aosp_15_r20/external/toybox/scripts/probes/GLOBALS (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1#!/bin/bash
2
3# Show bytes used by each command's GLOBALS() block, based on last build
4{
5  echo -e '#include "toys.h"\nint main(void) {'
6  sed -n 's/^\tstruct \(.*\)_data .*/printf("%d \1\\n", (int)sizeof(struct \1_data));/p' generated/globals.h
7  echo '}'
8} | "${CROSS_COMPILE}"cc -xc - && ./a.out | sort -n
9