From patchwork Wed Dec 17 23:24:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 4324 Received: (qmail 21282 invoked by alias); 17 Dec 2014 23:24:30 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 21269 invoked by uid 89); 17 Dec 2014 23:24:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] NPTL: Move fork state variables to initializer files. Message-Id: <20141217232426.59D942C3ABF@topped-with-meat.com> Date: Wed, 17 Dec 2014 15:24:26 -0800 (PST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=CN3E-hcAj0yg7yrUmzMA:9 a=CjuIK1q_8ugA:10 This has no material effect on existing configurations, except perhaps reducing dead code brought in when statically linking libpthread.a in. It moves each definition into the translation unit using it that is closest to the root of the link dependency graph. Tested x86_64-linux-gnu. Thanks, Roland * sysdeps/nptl/fork.c (__fork_generation_pointer): Variable moved ... * nptl/libc_pthread_init.c: ... here. * sysdeps/nptl/fork.c (__fork_handlers): Variable moved ... * nptl/register-atfork.c: ... here. --- a/nptl/libc_pthread_init.c +++ b/nptl/libc_pthread_init.c @@ -28,6 +28,9 @@ #include +unsigned long int *__fork_generation_pointer; + + #ifdef TLS_MULTIPLE_THREADS_IN_TCB void #else --- a/nptl/register-atfork.c +++ b/nptl/register-atfork.c @@ -23,6 +23,8 @@ #include +struct fork_handler *__fork_handlers; + /* Lock to protect allocation and deallocation of fork handlers. */ int __fork_lock = LLL_LOCK_INITIALIZER; --- a/sysdeps/nptl/fork.c +++ b/sysdeps/nptl/fork.c @@ -32,14 +32,6 @@ #include -unsigned long int *__fork_generation_pointer; - - - -/* The single linked list of all currently registered fork handlers. */ -struct fork_handler *__fork_handlers; - - static void fresetlockfiles (void) {