25845f
commit 8e1f346462d8c1b238a7c6bb501c45b381a45e4d
25845f
Author: H.J. Lu <hjl.tools@gmail.com>
25845f
Date:   Sun Jul 12 14:38:58 2015 -0700
25845f
25845f
    Align stack to 16 bytes when calling __setcontext
25845f
    
25845f
    Don't use pop to restore %rdi so that stack is aligned to 16 bytes
25845f
    when calling __setcontext.
25845f
    
25845f
            [BZ #18661]
25845f
            * sysdeps/unix/sysv/linux/x86_64/__start_context.S
25845f
            (__start_context): Don't use pop to restore %rdi so that stack
25845f
            is aligned to 16 bytes when calling __setcontext.
25845f
25845f
diff --git a/sysdeps/unix/sysv/linux/x86_64/__start_context.S b/sysdeps/unix/sysv/linux/x86_64/__start_context.S
25845f
index 9f2ee23736bfbf70..f59d6b4f7f3d3d43 100644
25845f
--- a/sysdeps/unix/sysv/linux/x86_64/__start_context.S
25845f
+++ b/sysdeps/unix/sysv/linux/x86_64/__start_context.S
25845f
@@ -31,8 +31,8 @@ ENTRY(__start_context)
25845f
 	   on the stack pointer for the next context.  */
25845f
 	movq	%rbx, %rsp
25845f
 
25845f
-	popq	%rdi			/* This is the next context.  */
25845f
-	cfi_adjust_cfa_offset(-8)
25845f
+	/* Don't use pop here so that stack is aligned to 16 bytes.  */
25845f
+	movq	(%rsp), %rdi		/* This is the next context.  */
25845f
 	testq	%rdi, %rdi
25845f
 	je	2f			/* If it is zero exit.  */
25845f