threads and libstdc++ on FreeBSD 5.2.1-RELEASE

Alexander Kabaev ak03 at gte.com
Mon Mar 15 09:28:29 PST 2004


On Mon, 15 Mar 2004 12:01:53 -0500
Alexander Kabaev <ak03 at gte.com> wrote:

> On Mon, 15 Mar 2004 18:16:16 +0200
> "Alex Kotov" <al_kotov at yahoo.com> wrote:
> 
> > Let me guess: you're using 5.2.1-CURRENT or link the application
> > against kse and not the lc_r?
> > 
> > I will try kse today but problem is easy to reproduce: just copy &
> > paste the source into the test.cc and build it as specified on top
> > of it. When you will try to start the binary you will get
> > "Segmentation fault (core dumped)".
> > 
> > SY,
> > Alex Kotov
> > 
> 
> I can reproduce this. Appears to be a bug in ld, which fails to pull
> in uthread_create.o from libc_c.a archive when linking the program.
> 
> -- 
> Alexander Kabaev

Follow-up: it appears ld is doing exacty as expected. Weak symbol
references are not supposed to cause archive member extraction accroding
to Sun docs. One can force it with -x weakextract on Solaris, but
unfortunately the version of ld in our binutils does not understand this
keyword.

This happens because libstdc++ marks pthread_create as weak in
gthr-default.h header.

-- 
Alexander Kabaev


More information about the freebsd-threads mailing list