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/9689] New: using profiling C library (-lc_p) segfaults early


building up glibc with --enable-profile and then trying to use the resulting
library like so:
$ cat test.c
main(){}
$ gcc test.c -static -pg -lc_p -g

results in a crash:
$ gdb ./a.out
(gdb) r
Starting program: /home/vapier/test

Program received signal SIGSEGV, Segmentation fault.
0x000000000042fecb in __mcount_internal ()
(gdb) bt
#0  0x000000000042fecb in __mcount_internal ()
#1  0x000000000040dc04 in mcount ()
#2  0x0000000000000000 in ?? ()
(gdb)

the crash seems to be because gmon/mcount.c uses atomic code which relies on the
TLS descriptors being setup, but that doesnt happen until __libc_start_main.  but
since __libc_start_main itself (and other functions early on) calls mcount, we
crash.

crash is easily reproducible with current git and x86_64 or x86.  it's been this
way since at least glibc-2.6.1.

-- 
           Summary: using profiling C library (-lc_p) segfaults early
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: vapier at gentoo dot org
                CC: glibc-bugs at sources dot redhat dot com,toolchain at
                    gentoo dot org
  GCC host triplet: x86_64-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=9689

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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