This is the mail archive of the glibc-bugs@sources.redhat.com 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/565] New: Linking with -lc_p and -lpthreads causes seg fault in all applications


The glibc profiling library and the pthreads library cannot be linked into the
same application.  Consider this simple program:

int main()
{
    return 0;
}

Compiled like so:

gcc -g -pg -o proftest proftest.cpp -lc_p -lpthread

This program will immediately segmentation fault when run.  I realize that the
pthreads library is not strictly needed for this program but it is needed for
the programs I am working on and this makes a simple test case.

Here is the stack trace which results from the crash:

bji$ ./proftest 
Segmentation fault (core dumped)
bji$ gdb ./proftest
GNU gdb Red Hat Linux (6.1post-1.20040607.41rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) r
[Thread debugging using libthread_db enabled]
[New Thread -1208019264 (LWP 2400)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208019264 (LWP 2400)]
0x0807999c in _dl_get_tls_static_info ()
(gdb) where
#0  0x0807999c in _dl_get_tls_static_info ()
#1  0x0052661c in __pthread_initialize_minimal_internal ()
   from /lib/tls/libpthread.so.0
#2  0x005262f8 in call_initialize_minimal () from /lib/tls/libpthread.so.0
#3  0x00525e98 in _init () from /lib/tls/libpthread.so.0
#4  0x00a752e4 in _dl_init_internal () from /lib/ld-linux.so.2
#5  0x00a697f5 in _dl_start_user () from /lib/ld-linux.so.2
(gdb) quit

Compiling without -lc_p or without -lpthread will work just fine.  But they
cannot be combined.

-- 
           Summary: Linking with -lc_p and -lpthreads causes seg fault in
                    all applications
           Product: glibc
           Version: 2.3.3
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: bji-glibc at ischo dot com
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: Fedora Core 3 (GNU/Linux)


http://sources.redhat.com/bugzilla/show_bug.cgi?id=565

------- 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]