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: [PATCHv2,HURD] Add fork hooks for pthread_atfork


Hi!

On Tue, 24 Sep 2013 23:08:15 +0200, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> 2013-09-24  Samuel Thibault  <samuel.thibault@ens-lyon.org>
> 
> pthread_atfork needs application callbacks to be called outside any locking.
> 
> * sysdeps/mach/hurd/fork.c (_hurd_atfork_prepare_hook, _hurd_atfork_child_hook,
> _hurd_atfork_parent_hook): New hooks.
> (__fork): Call _hurd_atfork_prepare_hook hooks before all locking, call
> _hurd_atfork_parent_hook or _hurd_atfork_child_hook after all unlocking.

This got pushed as commit 7b7bab1391a3b16fff7e325e2c8a36b68eacba90, which
for me causes the glibc build to fail with a linker error, which had also
already been reported twice on IRC (Alicia and Justus CCed), which I in
turn had forgotten about (but had diligently filed in our wiki page
open_issues/pthread_atfork; update is yet to be pushed), until I now hit
it myself:

    [...]/libc_pic.os: In function `__fork':
    [...]/posix/../sysdeps/mach/hurd/fork.c:70: undefined reference to `__start__hurd_atfork_prepare_hook'
    /usr/bin/ld: [...]/libc_pic.os: relocation R_386_GOTOFF against undefined hidden symbol `__start__hurd_atfork_prepare_hook' can not be used when making a shared object
    /usr/bin/ld: final link failed: Bad value
    collect2: error: ld returned 1 exit status
    make[2]: *** [[...]/libc.so] Error 1

This is the same issue we had before discussed in the thread starting at
<http://news.gmane.org/find-root.php?message_id=%3CE1SMKPZ-0000X2-7c%40vcs.savannah.gnu.org%3E>.

OK to commit the following?  We had this locally in t/hooks already, but
it had not been amended for the pthread_atfork symbols.

This Makefile rule is actually only used for the Âchecking for sufficient
default -shared layout... no case -- figuring out what that actually is
about is for another day.

2013-12-20  Thomas Schwinge  <thomas@codesourcery.com>
	    Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* Makerules ($(common-objpfx)shlib.lds): Provide start/stop symbols
	for Hurd hooks.

diff --git Makerules Makerules
index 92c2872..35cf552 100644
--- Makerules
+++ Makerules
@@ -482,6 +482,48 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
 		 PROVIDE(__start___libc_thread_subfreeres = .);\
 		 __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
 		 PROVIDE(__stop___libc_thread_subfreeres = .);\
+		 PROVIDE(__start__hurd_fd_subinit = .);\
+		 _hurd_fd_subinit : { *(_hurd_fd_subinit) }\
+		 PROVIDE(__stop__hurd_fd_subinit = .);\
+		 PROVIDE(__start__hurd_subinit = .);\
+		 _hurd_subinit : { *(_hurd_subinit) }\
+		 PROVIDE(__stop__hurd_subinit = .);\
+		 PROVIDE(__start__hurd_proc_subinit = .);\
+		 _hurd_proc_subinit : { *(_hurd_proc_subinit) }\
+		 PROVIDE(__stop__hurd_proc_subinit = .);\
+		 PROVIDE(__start__hurd_pgrp_changed_hook = .);\
+		 _hurd_pgrp_changed_hook : { *(_hurd_pgrp_changed_hook) }\
+		 PROVIDE(__stop__hurd_pgrp_changed_hook = .);\
+		 PROVIDE(__start__hurd_reauth_hook = .);\
+		 _hurd_reauth_hook : { *(_hurd_reauth_hook) }\
+		 PROVIDE(__stop__hurd_reauth_hook = .);\
+		 PROVIDE(__start__hurd_fork_locks = .);\
+		 _hurd_fork_locks : { *(_hurd_fork_locks) }\
+		 PROVIDE(__stop__hurd_fork_locks = .);\
+		 PROVIDE(__start__hurd_atfork_prepare_hook = .);\
+		 _hurd_atfork_prepare_hook : { *(_hurd_atfork_prepare_hook) }\
+		 PROVIDE(__stop__hurd_atfork_prepare_hook = .);\
+		 PROVIDE(__start__hurd_atfork_child_hook = .);\
+		 _hurd_atfork_child_hook : { *(_hurd_atfork_child_hook) }\
+		 PROVIDE(__stop__hurd_atfork_child_hook = .);\
+		 PROVIDE(__start__hurd_atfork_parent_hook = .);\
+		 _hurd_atfork_parent_hook : { *(_hurd_atfork_parent_hook) }\
+		 PROVIDE(__stop__hurd_atfork_parent_hook = .);\
+		 PROVIDE(__start__hurd_fork_prepare_hook = .);\
+		 _hurd_fork_prepare_hook : { *(_hurd_fork_prepare_hook) }\
+		 PROVIDE(__stop__hurd_fork_prepare_hook = .);\
+		 PROVIDE(__start__hurd_fork_setup_hook = .);\
+		 _hurd_fork_setup_hook : { *(_hurd_fork_setup_hook) }\
+		 PROVIDE(__stop__hurd_fork_setup_hook = .);\
+		 PROVIDE(__start__hurd_fork_child_hook = .);\
+		 _hurd_fork_child_hook : { *(_hurd_fork_child_hook) }\
+		 PROVIDE(__stop__hurd_fork_child_hook = .);\
+		 PROVIDE(__start__hurd_fork_parent_hook = .);\
+		 _hurd_fork_parent_hook : { *(_hurd_fork_parent_hook) }\
+		 PROVIDE(__stop__hurd_fork_parent_hook = .);\
+		 PROVIDE(__start__hurd_preinit_hook = .);\
+		 _hurd_preinit_hook : { *(_hurd_preinit_hook) }\
+		 PROVIDE(__stop__hurd_preinit_hook = .);\
 		 /DISCARD/ : { *(.gnu.glibc-stub.*) }@'
 	test -s $@T
 	mv -f $@T $@


GrÃÃe,
 Thomas

Attachment: pgpP0IdtMN4FZ.pgp
Description: PGP signature


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