This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Provide pthread_atfork in libc_nonshared.a and libc.a.


On 10/02/2013 05:31 PM, Carlos O'Donell wrote:
> Tested on x86-64 with no regressions.
> 
> There are no versioning requirements since this is all static libraries.
> 
> Verified pthread_atfork is available in libc_nonshared.a and libc.a
> afterwards and that it's available for linking without libpthread.
> 
> What kind of testcase, if any, should go along with this?
> 
> Before patch:
> [carlos@koi glibc]$ gcc -o /home/carlos/testatfork /home/carlos/testatfork.c 
> /tmp/ccmX2uMU.o: In function `main':
> testatfork.c:(.text+0x24): undefined reference to `pthread_atfork'
> collect2: error: ld returned 1 exit status
> 
> After patch the compilation and execution succeeds and the linker map shows:
> /home/carlos/install-glibc/usr/lib64/libc_nonshared.a(libc_pthread_atfork.oS)
>                               ./testatfork.o (pthread_atfork)
> ...
>  .text          0x00000000004006a0       0x1c /home/carlos/install-glibc/usr/lib64/libc_nonshared.a(libc_pthread_atfork.oS)
>                 0x00000000004006a0                __pthread_atfork
>                 0x00000000004006a0                pthread_atfork
> ...
> 
> Comments?
> 
> nptl/
> 
> 2013-10-02  Carlos O'Donell  <carlos@redhat.com>
> 
> 	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add libc_pthread_atfork.
> 	(static-only-routines): Likewise.
> 	* sysdeps/unix/sysv/linux/libc_pthread_atfork.c: New file.

Does anyone materially object to this fix to allow applications
to use pthread_atfork safely without requiring libpthread?

Aside from the objections that Rich raised, which are
general objections to the weakref-and-check idiom that
doesn't work with static linking.

The root cause that prompted this fix is that libselinux
has a need to use pthread_atfork and not require libpthread.

Given that pthread_atfork is a wrapper around __register_atfork
it seemed a natural fix to provide pthread_atfork in libc.a
and libc_nonshared.a.

OK to checkin?

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]