This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17213] New: Fail to generate gprof's gmon.out on powerpc64le


https://sourceware.org/bugzilla/show_bug.cgi?id=17213

            Bug ID: 17213
           Summary: Fail to generate gprof's gmon.out on powerpc64le
           Product: glibc
           Version: 2.20
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: azanella at linux dot vnet.ibm.com
                CC: drepper.fsp at gmail dot com

A  impler test case:

$ cat simple.c 
int
main (void)
{
  return 0;
}
$ gcc -pg simple.c

Fails to run on a powerpc64le:

$ ./a.out 
monstartup: out of memory

Using gdb, the call to __monstartup is clearly bogus:

(gdb) bt
#0  0x00003fffb7ef3b28 in __monstartup (lowpc=4053955791311343618,
highpc=268437740) at gmon.c:104
#1  0x00000000100004f8 in __gmon_start__ () at gmon-start.c:87
#2  0x0000000010000400 in _init () at ../sysdeps/powerpc/powerpc64/crti.S:77
#3  0x0000000010000768 in __libc_csu_init (argc=<optimized out>,
argv=<optimized out>, 
    envp=<optimized out>) at elf-init.c:83
#4  0x00003fffb7df4d0c in generic_start_main (main=0x100006c4 <main>,
argc=<optimized out>, 
    argv=0x3ffffffffa08, auxvec=0x3ffffffffae8, init=0x10000710
<__libc_csu_init>, 
    rtld_fini=<optimized out>, stack_end=<optimized out>, fini=<optimized out>)
    at ../csu/libc-start.c:244
#5  0x00003fffb7df4f74 in __libc_start_main (argc=<optimized out>,
argv=<optimized out>, 
    ev=<optimized out>, auxvec=<optimized out>, rtld_fini=<optimized out>,
stinfo=<optimized out>, 
    stack_on_entry=<optimized out>) at
../sysdeps/unix/sysv/linux/powerpc/libc-start.c:80
#6  0x0000000000000000 in ?? ()

The value of lowpc is clearly the problem.  This is from the source
csu/gmon-start.c:__gmon_start():

      /* Start keeping profiling records.  */
      __monstartup ((u_long) TEXT_START, (u_long) &etext);

TEXT_START in defined in ./sysdeps/powerpc/powerpc64/entry.h:

/* Use the address of ._start as the lowest address for which we need
   to keep profiling records.  We can't copy the ia64 scheme as our
   entry poiny address is really the address of the function
   descriptor, not the actual function entry.  */
#define TEXT_START \
  ({ extern unsigned long int _start_as_data[] asm ("_start");  \
     _start_as_data[0]; })

This seems wrong for ELFv2, since _start is not a function descriptor. A
straightforward patch is use the default defines:

diff --git a/sysdeps/powerpc/powerpc64/entry.h
b/sysdeps/powerpc/powerpc64/entry.h
index b1d4b7f..2843912 100644
--- a/sysdeps/powerpc/powerpc64/entry.h
+++ b/sysdeps/powerpc/powerpc64/entry.h
@@ -23,6 +23,7 @@ extern void _start (void);

 #define ENTRY_POINT _start

+#if _CALL_ELF != 2
 /* We have to provide a special declaration.  */
 #define ENTRY_POINT_DECL(class) class void _start (void);

@@ -33,3 +34,4 @@ extern void _start (void);
 #define TEXT_START \
   ({ extern unsigned long int _start_as_data[] asm ("_start");  \
      _start_as_data[0]; })
+#endif

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]