Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2009 17:49:37 +0200
From:      Alex Dupre <ale@FreeBSD.org>
To:        freebsd-threads@FreeBSD.org
Subject:   how to overcome missing stubs in FreeBSD 6
Message-ID:  <4AB8F211.3070707@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hello,
I have a scenario with a thread-safe library that uses pthread_equal()
function. In FreeBSD 7+ there is the appropriate libc stub, but in
FreeBSD 6 it's missing, so a single-threaded binary linked to this
library should be linked also to a threading library to resolve the
missing symbol.

This is not good for two reasons:
- additional overhead for useless threading lib
- different linking between FreeBSD versions

I thought that declaring pthread_equal() as weak symbol with a stub
function in the library would globally solve the problem in FreeBSD 6,
but actually it doesn't work as expected: a binary linked to the library
with -pthread continues to use the stub function instead of the one
defined in libpthread. The only way I found to make it working was to
link directly to -lpthread *before* the incriminated lib, but this is
not acceptable.

Is there a clean solution?

-- 
Alex Dupre



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