[PATCH] x86-64: work around gcc4 issue with -Os in Dwarf2 stack unwind
authorJan Beulich <jbeulich@novell.com>
Tue, 28 Nov 2006 19:12:59 +0000 (20:12 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 28 Nov 2006 19:12:59 +0000 (20:12 +0100)
This fixes a problem with gcc4 mis-compiling the stack unwind code under
-Os, which resulted in 'stuck' messages whenever an assembly routine was
encountered.

(The second hunk is trivial cleanup.)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
kernel/unwind.c

index f7e50d16dbf6b6ba55980dda3e0841d0a9d0d394..ed0a21d4a902339acef700eea0e291220ce7fb2a 100644 (file)
@@ -938,8 +938,11 @@ int unwind(struct unwind_frame_info *frame)
                else {
                        retAddrReg = state.version <= 1 ? *ptr++ : get_uleb128(&ptr, end);
                        /* skip augmentation */
-                       if (((const char *)(cie + 2))[1] == 'z')
-                               ptr += get_uleb128(&ptr, end);
+                       if (((const char *)(cie + 2))[1] == 'z') {
+                               uleb128_t augSize = get_uleb128(&ptr, end);
+
+                               ptr += augSize;
+                       }
                        if (ptr > end
                           || retAddrReg >= ARRAY_SIZE(reg_info)
                           || REG_INVALID(retAddrReg)
@@ -963,9 +966,7 @@ int unwind(struct unwind_frame_info *frame)
        if (cie == NULL || fde == NULL) {
 #ifdef CONFIG_FRAME_POINTER
                unsigned long top, bottom;
-#endif
 
-#ifdef CONFIG_FRAME_POINTER
                top = STACK_TOP(frame->task);
                bottom = STACK_BOTTOM(frame->task);
 # if FRAME_RETADDR_OFFSET < 0