]> xenbits.xensource.com Git - seabios.git/commitdiff
checkstack: Handle conditional checks at start of functions
authorKevin O'Connor <kevin@koconnor.net>
Wed, 10 Aug 2016 14:52:12 +0000 (10:52 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 10 Aug 2016 19:01:03 +0000 (15:01 -0400)
Recent versions of gcc will sometimes place conditional checks in the
code prior to setting up the function's stack frame.  Handle this case
correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
scripts/checkstack.py

index 5d9b0bfaf304d7d4b2a6d6c8128ad7f61ac807ec..255768aebce0341f0bb06d13973e653735aa5154 100755 (executable)
@@ -153,6 +153,11 @@ def main():
             if '%esp' in insn or insn.startswith('leal'):
                 # Still part of initial header
                 continue
+            if not stackusage and (
+                    insn.startswith('test') or insn.startswith('cmp')
+                    or insn.startswith('j')):
+                # There may be conditional checks prior to stack frame
+                continue
             cur.basic_stack_usage = stackusage
             atstart = 0