* elf/dl-reloc.c [PROF] (_dl_relocate_object): Define
authorUlrich Drepper <drepper@redhat.com>
Thu, 7 Jul 2005 02:39:45 +0000 (02:39 +0000)
committerUlrich Drepper <drepper@redhat.com>
Thu, 7 Jul 2005 02:39:45 +0000 (02:39 +0000)
consider_profiling always to zero.  Don't count of compiler to
remove unreached if block.
* sysdeps/x86_64/dl-trampoline.S [PROF] (_dl_runtime_profile):
Don't compile.
* sysdeps/i386/dl-trampoline.S [PROF] (_dl_runtime_profile): Likewise.
* sysdeps/ia64/dl-trampoline.S [PROF] (_dl_runtime_profile): Likewise.
* sysdeps/s390/s390-64/dl-trampoline.S [PROF] (_dl_runtime_profile):
Likewise.
* sysdeps/s390/s390-32/dl-trampoline.S [PROF] (_dl_runtime_profile):
Likewise.
* sysdeps/powerpc/powerpc64/dl-trampoline.S [PROF]
(_dl_profile_resolve): Likewise.
* sysdeps/powerpc/powerpc32/dl-trampoline.S [PROF]
(_dl_profile_resolve): Likewise.
* gmon/Makefile: Add rules to build and run tst-profile-static.
* gmon/tst-profile-static.c: New file.
* Makeconfig (+link-static): Allow passing program-specific flags.

12 files changed:
ChangeLog
Makeconfig
elf/dl-reloc.c
gmon/Makefile
gmon/tst-profile-static.c [new file with mode: 0644]
sysdeps/i386/dl-trampoline.S
sysdeps/ia64/dl-trampoline.S
sysdeps/powerpc/powerpc32/dl-trampoline.S
sysdeps/powerpc/powerpc64/dl-trampoline.S
sysdeps/s390/s390-32/dl-trampoline.S
sysdeps/s390/s390-64/dl-trampoline.S
sysdeps/x86_64/dl-trampoline.S

index b86177d..8d3fd11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2005-07-06  Ulrich Drepper  <drepper@redhat.com>
+
+       * elf/dl-reloc.c [PROF] (_dl_relocate_object): Define
+       consider_profiling always to zero.  Don't count of compiler to
+       remove unreached if block.
+       * sysdeps/x86_64/dl-trampoline.S [PROF] (_dl_runtime_profile):
+       Don't compile.
+       * sysdeps/i386/dl-trampoline.S [PROF] (_dl_runtime_profile): Likewise.
+       * sysdeps/ia64/dl-trampoline.S [PROF] (_dl_runtime_profile): Likewise.
+       * sysdeps/s390/s390-64/dl-trampoline.S [PROF] (_dl_runtime_profile):
+       Likewise.
+       * sysdeps/s390/s390-32/dl-trampoline.S [PROF] (_dl_runtime_profile):
+       Likewise.
+       * sysdeps/powerpc/powerpc64/dl-trampoline.S [PROF]
+       (_dl_profile_resolve): Likewise.
+       * sysdeps/powerpc/powerpc32/dl-trampoline.S [PROF]
+       (_dl_profile_resolve): Likewise.
+       * gmon/Makefile: Add rules to build and run tst-profile-static.
+       * gmon/tst-profile-static.c: New file.
+       * Makeconfig (+link-static): Allow passing program-specific flags.
+
 2005-07-05  Thorsten Kukuk  <kukuk@suse.de>
 
        * nis/nss_compat/compat-grp.c (internal_getgrgid_r): Check if NSS
index 4c3a4e3..b280aa5 100644 (file)
@@ -415,7 +415,7 @@ endif
 # Command for statically linking programs with the C library.
 ifndef +link-static
 +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
-             $(sysdep-LDFLAGS) $(LDFLAGS)  \
+             $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
              $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
              $(+preinit) $(+prector) \
              $(filter-out $(addprefix $(csu-objpfx),start.o \
index 2d309fb..117410e 100644 (file)
@@ -153,6 +153,9 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 #ifdef SHARED
   /* If we are auditing, install the same handlers we need for profiling.  */
   consider_profiling |= GLRO(dl_audit) != NULL;
+#elif defined PROF
+  /* Never use dynamic linker profiling for gprof profiling code.  */
+# define consider_profiling 0
 #endif
 
   if (l->l_relocated)
@@ -264,6 +267,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 
     ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling);
 
+#ifndef PROF
     if (__builtin_expect (consider_profiling, 0))
       {
        /* Allocate the array which will contain the already found
@@ -288,6 +292,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
            goto fatal;
          }
       }
+#endif
   }
 
   /* Mark the object so we know this work has been done.  */
index 80a7945..969edd5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1995, 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1995,1996,1997,2001,2002,2005 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,15 @@ routines := gmon mcount profil sprofil bb_init_func bb_exit_func prof-freq
 
 elide-routines.os = bb_init_func bb_exit_func
 
-tests  := tst-sprofil
+include ../Makeconfig
+
+tests  = tst-sprofil
+ifeq ($(build-profile),yes)
+tests  += tst-profile-static
+tests-static   += tst-profile-static
+
+LDFLAGS-tst-profile-static = -profile
+endif
 
 # The mcount code won't work without a frame pointer.
 CFLAGS-mcount.c := -fno-omit-frame-pointer
diff --git a/gmon/tst-profile-static.c b/gmon/tst-profile-static.c
new file mode 100644 (file)
index 0000000..b2f371e
--- /dev/null
@@ -0,0 +1,10 @@
+#include <stdio.h>
+static int
+do_test (void)
+{
+  puts ("Hello world");
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
index 80dd300..fd87eb7 100644 (file)
@@ -45,6 +45,7 @@ _dl_runtime_resolve:
        .size _dl_runtime_resolve, .-_dl_runtime_resolve
 
 
+#ifndef PROF
        .globl _dl_runtime_profile
        .type _dl_runtime_profile, @function
        cfi_startproc
@@ -180,3 +181,4 @@ _dl_runtime_profile:
        ret
        cfi_endproc
        .size _dl_runtime_profile, .-_dl_runtime_profile
+#endif
index b7969a6..1b31dc7 100644 (file)
@@ -175,7 +175,7 @@ END(_dl_runtime_resolve)
    16byte f13
    16byte f14
    16byte f15
-  
+
   Since stack has to be 16 byte aligned, the stack allocation is in
   16byte increment. Before calling _dl_profile_fixup, the stack will
   look like
@@ -189,6 +189,7 @@ END(_dl_runtime_resolve)
 #define PLTENTER_FRAME_SIZE (4*8 + 8*8 + 8*16 + 2*8 + 16)
 #define PLTEXIT_FRAME_SIZE (PLTENTER_FRAME_SIZE + 4*8 + 8*16)
 
+#ifndef PROF
 ENTRY(_dl_runtime_profile)
        { .mii
          .prologue
@@ -535,3 +536,4 @@ ENTRY(_dl_runtime_profile)
          ;;
        }
 END(_dl_runtime_profile)
+#endif
index ea5ce7b..506e802 100644 (file)
@@ -66,6 +66,7 @@ _dl_runtime_resolve:
        bctr
        .size    _dl_runtime_resolve,.-_dl_runtime_resolve
 
+#ifndef PROF
        .align 2
        .globl _dl_prof_resolve
        .type _dl_prof_resolve,@function
@@ -172,3 +173,4 @@ _dl_prof_resolve:
        addi r1,r1,320
        bctr
        .size    _dl_prof_resolve,.-_dl_prof_resolve
+#endif
index 0c61706..c90f961 100644 (file)
@@ -26,7 +26,7 @@
    and r11 contains the link_map (from PLT0+16).  The link_map becomes
    parm1 (r3) and the index (r0) need to be converted to an offset
    (index * 24) in parm2 (r4).  */
-   
+
 EALIGN(_dl_runtime_resolve, 4, 0)
 /* We need to save the registers used to pass parameters, ie. r3 thru
    r10; the registers are saved in a stack frame.  */
@@ -139,8 +139,8 @@ END(_dl_runtime_resolve)
         * Parameter save area, Allocated by the call, at least 8 double words
          +40    TOC save area
          +32    Reserved for linker
-         +24    Reserved for compiler 
-         +16    LR save area 
+         +24    Reserved for compiler
+         +16    LR save area
          +8     CR save area
        r1+0     stack back chain
        */
@@ -169,7 +169,7 @@ END(_dl_runtime_resolve)
    and r11 contains the link_map (from PLT0+16).  The link_map becomes
    parm1 (r3) and the index (r0) needs to be converted to an offset
    (index * 24) in parm2 (r4).  */
-   
+#ifndef PROF
 EALIGN(_dl_profile_resolve, 4, 0)
 /* Spill r30, r31 to preserve the link_map* and reloc_addr, in case we
    need to call _dl_call_pltexit.  */
@@ -215,23 +215,23 @@ EALIGN(_dl_profile_resolve, 4, 0)
        li      r12,64
        stvx    v2,0,r10
        stvx    v3,0,r9
-       
+
        stvx    v4,r11,r10
        stvx    v5,r11,r9
        addi    r11,r11,64
-       
+
        stvx    v6,r12,r10
        stvx    v7,r12,r9
        addi    r12,r12,64
-       
+
        stvx    v8,r11,r10
        stvx    v9,r11,r9
        addi    r11,r11,64
-       
+
        stvx    v10,r12,r10
        stvx    v11,r12,r9
        mfspr   r0,VRSAVE
-       
+
        stvx    v12,r11,r10
        stvx    v13,r11,r9
 L(saveFP):
@@ -262,7 +262,7 @@ L(saveFP):
        nop
 /* Test *framesizep > 0 to see if need to do pltexit processing.  */
        ld      r0,STACK_FRAME(r1)
-/* Put the registers back.  */ 
+/* Put the registers back.  */
        lwz     r12,VR_VRSAVE(r1)
        cmpdi   cr1,r0,0
        cmpdi   cr0,r12,0
@@ -275,22 +275,22 @@ L(saveFP):
        li      r12,64
        lvx     v2,0,r10
        lvx     v3,0,r9
-       
+
        lvx     v4,r11,r10
        lvx     v5,r11,r9
        addi    r11,r11,64
-       
+
        lvx     v6,r12,r10
        lvx     v7,r12,r9
        addi    r12,r12,64
-       
+
        lvx     v8,r11,r10
        lvx     v9,r11,r9
        addi    r11,r11,64
-       
+
        lvx     v10,r12,r10
        lvx     v11,r12,r9
-       
+
        lvx     v12,r11,r10
        lvx     v13,r11,r9
 L(restoreFXR):
@@ -339,22 +339,22 @@ L(do_pltexit):
        li      r12,64
        lvx     v2,0,r10
        lvx     v3,0,r9
-       
+
        lvx     v4,r11,r10
        lvx     v5,r11,r9
        addi    r11,r11,64
-       
+
        lvx     v6,r12,r10
        lvx     v7,r12,r9
        addi    r12,r12,64
-       
+
        lvx     v8,r11,r10
        lvx     v9,r11,r9
        addi    r11,r11,64
-       
+
        lvx     v10,r12,r10
        lvx     v11,r12,r9
-       
+
        lvx     v12,r11,r10
        lvx     v13,r11,r9
 L(restoreFXR2):
@@ -393,7 +393,7 @@ L(restoreFXR2):
        lfd     fp13,FPR_PARMS+96(r1)
 /* Call the target function.  */
        bctrl
-       ld      r2,40(r1)       
+       ld      r2,40(r1)
        lwz     r12,VR_VRSAVE(r1)
 /* But return here and store the return values.  */
        std     r3,INT_RTN(r1)
@@ -413,7 +413,7 @@ L(callpltexit):
        addi    r6,r1,INT_RTN
        bl      JUMPTARGET(_dl_call_pltexit)
        nop
-/* Restore the return values from target function.  */ 
+/* Restore the return values from target function.  */
        lwz     r12,VR_VRSAVE(r1)
        ld      r3,INT_RTN(r1)
        ld      r4,INT_RTN+8(r1)
@@ -433,3 +433,4 @@ L(pltexitreturn):
        ld      r1,0(r1)
        blr
 END(_dl_profile_resolve)
+#endif
index 4ee2295..fbbbc18 100644 (file)
@@ -64,6 +64,7 @@ _dl_runtime_resolve:
        .size _dl_runtime_resolve, .-_dl_runtime_resolve
 
 
+#ifndef PROF
        .globl _dl_runtime_profile
        .type _dl_runtime_profile, @function
        cfi_startproc
@@ -124,10 +125,10 @@ _dl_runtime_profile:
 5:     l      %r14,7f-5b(%r1)
        la     %r4,32(%r12)             # pointer to struct La_s390_32_regs
        la     %r5,72(%r12)             # pointer to struct La_s390_32_retval
-       basr   %r14,%r1                 # call _dl_call_pltexit 
+       basr   %r14,%r1                 # call _dl_call_pltexit
        j      1b
 6:     .long  _dl_profile_fixup - 0b
 7:     .long  _dl_call_pltexit - 5b
        cfi_endproc
        .size _dl_runtime_profile, .-_dl_runtime_profile
-
+#endif
index 215d869..8093582 100644 (file)
@@ -58,6 +58,7 @@ _dl_runtime_resolve:
        .size _dl_runtime_resolve, .-_dl_runtime_resolve
 
 
+#ifndef PROF
        .globl _dl_runtime_profile
        .type _dl_runtime_profile, @function
        cfi_startproc
@@ -124,3 +125,4 @@ _dl_runtime_profile:
        j      0b
        cfi_endproc
        .size _dl_runtime_profile, .-_dl_runtime_profile
+#endif
index eb46f29..c1686da 100644 (file)
@@ -56,7 +56,7 @@ _dl_runtime_resolve:
        .size _dl_runtime_resolve, .-_dl_runtime_resolve
 
 
-
+#ifndef PROF
        .globl _dl_runtime_profile
        .type _dl_runtime_profile, @function
        .align 16
@@ -186,3 +186,4 @@ _dl_runtime_profile:
        retq
        cfi_endproc
        .size _dl_runtime_profile, .-_dl_runtime_profile
+#endif