Module Name:    src
Committed By:   joerg
Date:           Tue Nov 30 18:37:59 UTC 2010

Modified Files:
        src/lib/csu/arch/x86_64: crtbegin.S

Log Message:
Fix stack alignment for non-constructor/destructor calls.
AMD64 stack is 16 Byte aligned at the start of the function,
so always push rbx.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/x86_64/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/x86_64/crtbegin.S
diff -u src/lib/csu/arch/x86_64/crtbegin.S:1.1 src/lib/csu/arch/x86_64/crtbegin.S:1.2
--- src/lib/csu/arch/x86_64/crtbegin.S:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/x86_64/crtbegin.S	Tue Nov 30 18:37:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.1 2010/08/07 18:01:34 joerg Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $	*/
 /*-
  * Copyright (c) 2010 Joerg Sonnenberger <jo...@netbsd.org>
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: crtbegin.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
+RCSID("$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $")
 
 	.section	.ctors, "aw", @progbits
 	.align 8
@@ -82,6 +82,7 @@
 	je	1f
 	ret
 1:
+	pushq	%rbx
 	movb	$1, __finished(%rip)
 
 
@@ -93,7 +94,6 @@
 2:
 #endif
 
-	pushq	%rbx
 	leaq	8+__DTOR_LIST__(%rip), %rbx
 3:
 	movq	(%rbx), %rax
@@ -103,14 +103,13 @@
 	addq	$8, %rbx
 	jmp	3b	
 4:
-	popq	%rbx
 
 	cmpq	$0, __deregister_frame_i...@gotpcrel(%rip)
 	je	5f
 	leaq	__EH_FRAME_LIST__(%rip), %rdi
 	call	__deregister_frame_i...@plt
 5:
-
+	popq	%rbx
 	ret
 
 
@@ -119,6 +118,7 @@
 	je	1f
 	ret
 1:
+	pushq	%rbx
 	movb	$1, __initialized(%rip)
 
 	cmpq	$0, __register_frame_i...@gotpcrel(%rip)
@@ -136,7 +136,6 @@
 	call	_jv_registerclas...@plt
 3:
 
-	pushq	%rbx
 	leaq	-8+__CTOR_LIST_END__(%rip), %rbx
 4:
 	movq	(%rbx), %rax

Reply via email to