Why weak referencing pthread_equal() in k5-thread.h?

Ken Raeburn raeburn at MIT.EDU
Tue Apr 12 01:33:18 EDT 2005


On Apr 11, 2005, at 22:27, KAMADA Ken'ichi wrote:
> Why pthread_*() other than pthread_once() and
> pthread_mutexattr_setrobust_np() are weakly referenced in k5-thread.h?
> I see pthread_once() and pthread_mutexattr_setrobust_np() are used to
> check whether the libpthread is loaded in the K5_PTHREAD_LOADED macro,
> but I don't see why other functions need to be weakly referenced.

Different systems have different sets of stubs.  To make things worse, 
some systems have stubs that just don't work.

> Background:
>
> MIT krb5-1.4 (and current on Apr 6) doesn't work on NetBSD
> (unless the calling program is linked with libpthread).

Okay, that's a bug...  Odd that we didn't catch it, we do some test 
builds on NetBSD.  Oh, but we tend to expect the runtime tests to fail 
on NetBSD, because of some RPC issues, so we might not have noticed if 
the failure happened earlier in the run.

I'll try to fix this up.  I don't know if it'll get into the 1.4.1 
release coming soon, though.

> NetBSD's libc doesn't have a stub for pthread_equal(), but
> MIT krb5 is weakly referencing pthread_equal().
> Therefore the absense of pthread_equal() is not detected on the
> link-time, and programs using krb5 mysteriously dies at run-time.
>
> # BTW, I'll ask NetBSD to add pthread_equal stub.

If it's convenient, sure.  We should fix our code to deal with it being 
absent, anyways.

Thanks for the report.  I'm sorry we didn't catch it sooner.

Ken



More information about the krbdev mailing list