Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jun 2003 23:02:45 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        xiong jinshan <xiongjinshan@yahoo.com>
Cc:        threads@freebsd.org
Subject:   Re: About the kse signal process
Message-ID:  <Pine.GSO.4.10.10306302255150.3758-100000@pcnet5.pcnet.com>
In-Reply-To: <20030701022915.50290.qmail@web80503.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 30 Jun 2003, xiong jinshan wrote:
> 
> --- Daniel Eischen <eischen@vigrid.com> wrote:
> > On Mon, 30 Jun 2003, xiong jinshan wrote:
> > > It received the SIGSEGV before the main() when I
> > > linked   with libc_r;(.
> > 
> > I think you have something screwed up somewhere.
> > How did you compile and link it?
> 
> Yes, it maybe my fault. 
> 
> If I link libc_r with static, it works correctly. 
> If I link it with dynamic, segv occurs.
> If I not linked c_r, th_func() couldn't received the
> alarm.
> 
> Why must it be linked with static mode? Does it mean
> the native c library in release 5.1 not reentrant?

It doesn't have to be statically linked.  Are you
explicitly using -lc? (don't!)  In 5.x, you link
threaded programs (if linking against libc_r) with:

	gcc -o app app.c -lc_r

Or, using the deprecated -pthread option:

	gcc -o app -pthread app.c

As I said, it works here for me on -current.  It doesn't
look like anything has changed in libc_r since 5.1.

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10306302255150.3758-100000>