summaryrefslogtreecommitdiff
path: root/src/util/check-stack
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/check-stack')
-rwxr-xr-xsrc/util/check-stack13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/check-stack b/src/util/check-stack
new file mode 100755
index 00000000..1e8044e0
--- /dev/null
+++ b/src/util/check-stack
@@ -0,0 +1,13 @@
+#!/bin/sh
+HEADER=$1
+MEM=$2
+
+HEADER_STACK=`awk '/#define AO_STACK_START/ {print strtonum($3)}' $HEADER`
+MEM_STACK=`awk '/Stack starts at/ {print strtonum ($4)}' $MEM`
+
+if [ "$HEADER_STACK" -lt "$MEM_STACK" ]; then
+ echo $MEM_STACK | awk '{ printf ("Set AO_STACK_START to at least 0x%x\n", $1); }'
+ exit 1
+else
+ exit 0
+fi