This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Provide pthread_atfork in libc_nonshared.a and libc.a.
- From: Rich Felker <dalias at aerifal dot cx>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Jakub Jelinek <jakub at redhat dot com>, Roland McGrath <roland at hack dot frob dot com>
- Date: Wed, 2 Oct 2013 17:36:04 -0400
- Subject: Re: [PATCH] Provide pthread_atfork in libc_nonshared.a and libc.a.
- Authentication-results: sourceware.org; auth=none
- References: <524C90A1 dot 6050801 at redhat dot com>
On Wed, Oct 02, 2013 at 05:31:13PM -0400, Carlos O'Donell wrote:
> 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.