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: 422409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 892EB140079 for ; Thu, 18 Dec 2014 10:24:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=kz8Casf89uK/Awjn7qDc4+KFgya6W73klNtrDuNuhOk9yR iY2/Cddr/5AVHuY3aoEcppHkExqe5bVJTbMnhwC5lxEA87L4o2PV7ZRB8278ZEM1 fFanpIWYu72kdHGsWg1mfE4xyUCWrJytmsGoFZziC0kJ8gXrcb6Aoci0mk4eY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=93yF71Alt3NrXAFwUSRN4+6lz5A=; b=yTCLwnBvQ5oAfmC4ocLH ZBzx8dmHOAJjaIiIUQRkincVrpd/1YlPCmS/aO7zrdqHKn6Nd/q0jB3t8g2T9Kw1 quYOl0SDaPBw/U0a2wG8aqyBfSVPOuIw03HiH8Mw5fUVP4emDS8HgF/Y8KbsoAGP K1rXLJ79uwe+GrbOKHQ3jFU= 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) {