summary refs log tree commit diff
path: root/sysdeps/x86_64/_mcount.S
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2010-08-07 21:24:05 -0700
committerUlrich Drepper <drepper@redhat.com>2010-08-07 21:24:05 -0700
commitd22e4cc9397ed41534c9422d0b0ffef8c77bfa53 (patch)
treecf2a4b5b9970dcb959f2b41e44e38ff2914657bd /sysdeps/x86_64/_mcount.S
parent805bc17d6883bf6d47e49620d6f8e1b97cac9901 (diff)
downloadglibc-d22e4cc9397ed41534c9422d0b0ffef8c77bfa53.tar.gz
glibc-d22e4cc9397ed41534c9422d0b0ffef8c77bfa53.tar.xz
glibc-d22e4cc9397ed41534c9422d0b0ffef8c77bfa53.zip
x86: Add support for frame pointer less mcount
Diffstat (limited to 'sysdeps/x86_64/_mcount.S')
-rw-r--r--sysdeps/x86_64/_mcount.S38
1 files changed, 38 insertions, 0 deletions
diff --git a/sysdeps/x86_64/_mcount.S b/sysdeps/x86_64/_mcount.S
index c005932c0c..ef046dc3c5 100644
--- a/sysdeps/x86_64/_mcount.S
+++ b/sysdeps/x86_64/_mcount.S
@@ -65,3 +65,41 @@ C_LABEL(_mcount)
 
 #undef mcount
 weak_alias (_mcount, mcount)
+
+	ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(__fentry__)
+	ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(__fentry__), @function)
+	.align ALIGNARG(4)
+C_LABEL(__fentry__)
+	/* Allocate space for 7 registers.  */
+	subq	$64,%rsp
+	movq	%rax,(%rsp)
+	movq	%rcx,8(%rsp)
+	movq	%rdx,16(%rsp)
+	movq	%rsi,24(%rsp)
+	movq	%rdi,32(%rsp)
+	movq	%r8,40(%rsp)
+	movq	%r9,48(%rsp)
+
+	/* Setup parameter for __mcount_internal.  */
+	/* selfpc is the return address on the stack.  */
+	movq	64(%rsp),%rsi
+	/* caller is the return address above it */
+	movq	72(%rsp),%rdi
+#ifdef PIC
+	call C_SYMBOL_NAME(__mcount_internal)@PLT
+#else
+	call C_SYMBOL_NAME(__mcount_internal)
+#endif
+	/* Pop the saved registers.  Please note that `__fentry__' has no
+	   return value.  */
+	movq	48(%rsp),%r9
+	movq	40(%rsp),%r8
+	movq	32(%rsp),%rdi
+	movq	24(%rsp),%rsi
+	movq	16(%rsp),%rdx
+	movq	8(%rsp),%rcx
+	movq	(%rsp),%rax
+	addq	$64,%rsp
+	ret
+
+	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(__fentry__))