Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2006 16:29:03 +0200 (CEST)
From:      Gergely CZUCZY <phoemix@harmless.hu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   threads/104297: mixing libthr and libpthread through libs segfaults the binary
Message-ID:  <200610111429.k9BET3aF047135@marvin.harmless.hu>
Resent-Message-ID: <200610111430.k9BEUGDi067051@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         104297
>Category:       threads
>Synopsis:       mixing libthr and libpthread through libs segfaults the binary
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-threads
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 11 14:30:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Gergely CZUCZY
>Release:        FreeBSD 6.1-RELEASE-p7 i386
>Organization:
Harmless Digital Ltd
>Environment:
System: FreeBSD marvin.harmless.hu 6.1-RELEASE-p7 FreeBSD 6.1-RELEASE-p7 #0: Sun Sep 24 09:02:34 CEST 2006 root@marvin.harmless.hu:/usr/obj/usr/src/sys/MARVIN i386
installed PostgreSQL 8.1 which uses pthread (-lpthread)

>Description:
If you build a binary which you link against libthr, and it
will also be linked against a library which is linked against libpthread
the output binary will segfault.


>How-To-Repeat:
$ cat > test.c
int main(int argc, char *argv[]) {
  return 0;
}
^C
$ export LDFLAGS="-lthr -L/usr/local/lib -lpq"
$ make test && ./test
c++ -O2 -pipe -march=pentium4 -lkse -L/usr/local/lib -lpq test.cc -o test
Segmentation fault: 11 (core dumped)

I've tested it with three variation of LDFLAGS, it apperas
that only libthr is broken.
working ones:
export LDFLAGS="-lthread -L/usr/local/lib -lpq"
export LDFLAGS="-lc_r -L/usr/local/lib -lpq"

segfaults:
export LDFLAGS="-lthr -L/usr/local/lib -lpq"


>Fix:
N/A



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610111429.k9BET3aF047135>