[PATCH] Provide pthread_atfork in libc_nonshared.a and libc.a.
Rich Felker
dalias@aerifal.cx
Wed Oct 2 21:36:00 GMT 2013
On Wed, Oct 02, 2013 at 05:31:13PM -0400, Carlos O'Donell wrote:
> Community,
>
> The standard design pattern for making it optional to link against
> libpthread is to mark the function weak, test if the function
> address is non-zero and call the function, otherwise use a fallback.
This idiom is completely wrong; it does not work with static linking.
Programs which are using this approach need to be fixed. We've also
run into it (much more heavily) with musl libc, where unlike in glibc,
the pthread .o files in libc.a are well-factored so that only the
code the program needs gets linked. The offender that comes to mind
right off is libxml2.
Rich
More information about the Libc-alpha
mailing list