NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/41050: pthread doesn't work with statically linked programs



>Number:         41050
>Category:       lib
>Synopsis:       pthread doesn't work with statically linked programs
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 21 05:00:00 +0000 2009
>Originator:     Antti Kantee
>Release:        5.0_RC2/i386
>Organization:
>Environment:
>Description:
Try to run a statically linked binary which uses pthread on NetBSD 5.
Observe it dump core in malloc.  Without -static linking things
work peachy.  Also, this used to work in NetBSD 4.99.42.
>How-To-Repeat:
#include <pthread.h>
#include <stdlib.h>

int
main()
{
        pthread_mutex_t mtx;
        void *v;

        v = malloc(100);
        pthread_mutex_init(&mtx, NULL);
}

pain-rustique:45:~> cc -g -static -o ptest ptest.c -lpthread
pain-rustique:46:~> ./ptest 

Program terminated with signal 11, Segmentation fault.
#0  0x0804baee in pthread_curcpu_np ()
(gdb) bt
#0  0x0804baee in pthread_curcpu_np ()
#1  0x08051c8c in posix_memalign ()
#2  0x0805227c in malloc ()
#3  0x080483a3 in main () at ptest.c:10

>Fix:
unknown



Home | Main Index | Thread Index | Old Index