Fix x86 cfi directives for syscalls.

The syscall generation always used 4 bytes for each push cfi directive.
However, the first push should always use an offset of 8 bytes, each
subsequent push after that is only 4 bytes though.

Change-Id: Ibaabd107f399ef67010b9a08213783957c2f74a9
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 87d51e3..5e4ddc5 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -323,17 +323,20 @@
     stack_bias = numparams*4 + 4
     offset = 0
     mov_result = ""
-    cfi_result = "    .cfi_def_cfa_offset %d\n" % (numparams*4)
+    first_push = True
     for register in x86_registers[:numparams]:
         result     += "    pushl   %%%s\n" % register
+        if first_push:
+          result   += "    .cfi_def_cfa_offset 8\n"
+          result   += "    .cfi_rel_offset %s, 0\n" % register
+          first_push = False
+        else:
+          result   += "    .cfi_adjust_cfa_offset 4\n"
+          result   += "    .cfi_rel_offset %s, 0\n" % register
         mov_result += "    mov     %d(%%esp), %%%s\n" % (stack_bias+offset, register)
-        cfi_result += "    .cfi_rel_offset %s, %d\n" % (register, offset)
         offset += 4
 
-    if numparams:
-        result += cfi_result
-        result += mov_result
-
+    result += mov_result
     result += x86_call % syscall
 
     for register in reversed(x86_registers[:numparams]):
@@ -353,10 +356,11 @@
 
     # save the regs we need
     result += "    pushl   %ebx\n"
-    result += "    pushl   %ecx\n"
     result += "    .cfi_def_cfa_offset 8\n"
     result += "    .cfi_rel_offset ebx, 0\n"
-    result += "    .cfi_rel_offset ecx, 4\n"
+    result += "    pushl   %ecx\n"
+    result += "    .cfi_adjust_cfa_offset 4\n"
+    result += "    .cfi_rel_offset ecx, 0\n"
     stack_bias = 12
 
     # set the call id (%ebx)