]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Add support for frame pointer less mcount
authorAndi Kleen <ak@linux.intel.com>
Sun, 8 Aug 2010 04:24:05 +0000 (21:24 -0700)
committerUlrich Drepper <drepper@redhat.com>
Sun, 8 Aug 2010 04:24:05 +0000 (21:24 -0700)
ChangeLog
Versions.def
stdlib/Versions
sysdeps/i386/i386-mcount.S
sysdeps/x86_64/_mcount.S

index 012efd860daedfd70234f720d8e68280d8276350..7af076ba841154e666d6f92e8321dc9187f6ef16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-17  Andi Kleen  <ak@linux.intel.com>
+
+       * sysdeps/i386/i386-mcount.S (__fentry__): Define.
+       * sysdeps/x86_64/_mcount.S (__fentry__): Define.
+       * stdlib/Versions (__fentry__): Add for GLIBC 2.13
+       * Versions.def [GLIBC_2.13]: Add.
+
 2010-08-06  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
index eab006b83f6a98e72fec49bd1938179876c53e06..0ccda50dab1cef738d99aa96f13199fc01e06ee3 100644 (file)
@@ -29,6 +29,7 @@ libc {
   GLIBC_2.10
   GLIBC_2.11
   GLIBC_2.12
+  GLIBC_2.13
 %ifdef USE_IN_LIBIO
   HURD_CTHREADS_0.3
 %endif
index 3e7b8921c4c3152abf69f25fd68257e356ebf323..2aa396ecb7ec320fbd1d8425027f2ca0c0793fbc 100644 (file)
@@ -100,6 +100,9 @@ libc {
   GLIBC_2.10 {
     quick_exit; __cxa_at_quick_exit;
   }
+  GLIBC_2.13 {
+    __fentry__;
+  }
   GLIBC_PRIVATE {
     # functions which have an additional interface since they are
     # are cancelable.
index 8b11adb2e33fed10182d0286e7379d84e12741c6..43bc0194dddb6cd9d6f64a376df9953d12220bcf 100644 (file)
@@ -53,3 +53,28 @@ C_LABEL(_mcount)
 
 #undef mcount
 weak_alias (_mcount, mcount)
+
+       /* Same as above, but doesn't require a frame pointer */
+       ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(__fentry__)
+       ASM_TYPE_DIRECTIVE(C_SYMBOL_NAME(__fentry__), @function)
+       .align ALIGNARG(4)
+C_LABEL(__fentry__)
+       /* Save the caller-clobbered registers.  */
+       pushl %eax
+       pushl %ecx
+       pushl %edx
+
+       movl 12(%esp), %edx
+       movl 16(%esp), %eax
+
+       /* No need to access the PLT or GOT, __mcount_internal is an
+          internal function and we can make a relative call.  */
+       call C_SYMBOL_NAME(__mcount_internal)
+
+       /* Pop the saved registers.  Please note that `__fentry__' has no
+          return value.  */
+       popl %edx
+       popl %ecx
+       popl %eax
+       ret
+       ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(__fentry__))
index c005932c0c80af3c0fda23b9e6cd0c5470420064..ef046dc3c57a4ddd25d6719da4e83004ac0eca80 100644 (file)
@@ -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__))