weak implementation of threads has problems - kse fix attached
Sean McNeil
sean at mcneil.com
Tue Jun 8 07:40:48 GMT 2004
On Mon, 2004-06-07 at 22:34, Daniel Eischen wrote:
> On Tue, 8 Jun 2004, John Birrell wrote:
>
> > [ cross-post lists cut back, ports added 8-) ]
> >
> > On Mon, Jun 07, 2004 at 11:48:45PM -0500, Dan Nelson wrote:
> > > A good addition to bsd.port.mk, right next to the "possible network
> > > server" etc checks, might be to run ldd on all installed shared
> > > libraries and print a warning if any threads libraries show up. There
> > > are a huge number of ports that install shlibs linked to libpthreads.
> >
> > Good idea.
>
> Just picking a message at random to reply to...
>
> In case anyone wonders why we don't use strong references, I chose to
> mimic what Solaris does:
>
> bash-2.05$ nm /lib/libpthread.so.1 | grep pthread_mutex_lock
> 0000000000003c80 T _pthread_mutex_lock
> 0000000000003c80 W pthread_mutex_lock
>
> bash-2.05$ nm /lib/libc.so.1 | grep pthread_mutex_lock
> 0000000000096c38 W _pthread_mutex_lock
> 0000000000096c38 W pthread_mutex_lock
>
> It is also easy to provide your own version of pthread_foo() without
> having any strong references override it.
OK, that is what I was wondering. In that case, you have failed to
mimic Solaris:
[sean at wrsparc sean]$ uname -a
SunOS wrsparc.mcneil.com 5.7 Generic_106541-12 sun4u sparc SUNW,Ultra-5_10
[sean at wrsparc sean]$ nm /lib/libpthread.so.1 | grep select
[201] | 21328| 8|FUNC |GLOB |0 |8 |select
[sean at wrsparc sean]$ nm /lib/libc.so.1 | grep select
[213] | 320732| 1420|FUNC |LOCL |0 |12 |_libc_select
[4534] | 320732| 1420|FUNC |GLOB |0 |12 |_select
[3556] | 320732| 1420|FUNC |WEAK |0 |12 |select
[1385] | 0| 0|FILE |LOCL |0 |ABS |select.c
[4404] | 322152| 1920|FUNC |GLOB |0 |12 |select_large_fdset
[1387] | 0| 0|FILE |LOCL |0 |ABS |select_large_fdset.c
Same thing with open or any of the other libc functions.
That is why Solaris works correctly and FreeBSD does not.
More information about the freebsd-ports
mailing list