From patchwork Mon Oct 16 20:44:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 115985 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4102068qgn; Mon, 16 Oct 2017 13:44:45 -0700 (PDT) X-Received: by 10.159.218.68 with SMTP id x4mr9582195plv.291.1508186685523; Mon, 16 Oct 2017 13:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508186685; cv=none; d=google.com; s=arc-20160816; b=ZYj45NAC3Esm43qE35WKJJkwlUcI0YqBx3LEvDFhCmHrl+ERFe09PAIBFp5liEMNx+ IQa7b1Lc/2mwkQdGLk3CxKza4V0CyGsUU0kcC10f6sH3DrBKsoZiKBh+dC6Mc0HAolre DqhJ8PAYpmVyNT3tipSMHU3hLlDcYRjbKF8vjAr0zYYQVA+eXMZn+1DaCziVR/7Bvg3G VPqmh3XQnDTam8dtr8Jl8MKzXCmbctGMWF02Z6I1u6BKPDWIom8DBsEaoT6RpGTKFnvO Xjk5S6vl1fHhBXVCIeTfUC92wQJyvrGbtNf7s//TFFjdAqRUfYgmUM+9pl19U01lXusF jQQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=m/5tH104ZN96Sico6s3Ge4O3RmPMjvvUR8IQfcAIQYA=; b=mCLeR4KH16PsbmFBomiJ/wbmL/Wv2XvmaeQa9kg4kVgUkxIF/k8Ow5So1G4l5ZU3bC 2Pg+m56y06MMyYMnxwUhAqjJvs2XQ3bAv8IgQWjNkxOI4Z4qN4LFCas20zY0DxmUFCJM Rmg/LcFc09H9rtHEkNJc86Om7ZZjm02PtARSGBhazJ9MVckxJuXKgcdGU6U5A+Tl3h4l /VZIzLayeG48b7lkAbffeU9Oz6cUTdTKttLFlqB5F3CkvIcBCpKBbmg0Q/UEPIPiGtEV 8wQ+KFo3dTDei4xPI96S4ugzf75LzIdHMnFlSg9dlzOJ/9qduSZJj3kL5K+VwvbPtlhq 8cVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BTFuQnnH; spf=pass (google.com: domain of libc-alpha-return-85910-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-85910-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p25si4257831pgn.126.2017.10.16.13.44.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 13:44:45 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-85910-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BTFuQnnH; spf=pass (google.com: domain of libc-alpha-return-85910-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-85910-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=MPQ0Av46gY09Oqs3PRQjER88m5ip/e/jL67XCPiSRyFqPlHxWsWjK BjItQikb0QEW0IEhOTnShq1Cr/cARft43ejFPrZ6YDTcMNPqZvzrVAupPw39D5/V YHqUd2QCGNfRoCWiVkdpTQC2bt5Mq0GY5EAIO8UZczUSxjstIL25ao= 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:from:to:subject:date:message-id; s=default; bh=SSHlotsvFv5H7tBKzRoyO2KElIA=; b=BTFuQnnHN62nQo8Hb+y9zeZ7Neql dyUURU0n+z4tYUEeNnZ+mA7txl74cn2ef4WMLthf0CgRwFIX90CUkkfa4swzfr0m WHF7cRP9YrDXPH9iMC0k2ANo3mM6plJ0ECIRcNoyMa55k+52fTX2xb+lXv6OMySS bCf9dviMFtBP3Kk= Received: (qmail 129283 invoked by alias); 16 Oct 2017 20:44:25 -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 129254 invoked by uid 89); 16 Oct 2017 20:44:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f176.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=m/5tH104ZN96Sico6s3Ge4O3RmPMjvvUR8IQfcAIQYA=; b=ieuHyAWl4Tyg/t6LShIMhM2iEoSlTRwSQXYP9c+T12l/fZQe9My1By6zKRrfxATnPH c6buLbA3n3e4neLHpRelbC/1zpzEhoJ030nRwP9aJ6Jg/5sOiz9MH4+GkR+XI+y1UCvL HbgDTcq0TZfjx59oCC4XgA6tTD3Y1hcv7s+jPj6qVONVuN8rfKGHZLPRMsU2Erx9KSFA b/RPlnz/3dNsq3VbJvHeedZ82RDN4eIdV47/svbW6fYO9tEylJZb1cUieb3hFgvj0mMp bG2+FF7dzJbwqLxhrY/hgASqlASEl5diISwMjIgVtg2/yl8D9qIxnOyv+J6DYmN/lc/c HzYA== X-Gm-Message-State: AMCzsaVh5GD0QWu6tj3A1ixypyIWz07F/QavRrNw2plV1MUUAuIkfBSj AfnBYe0gJBsOvuTKvuiVoJgQmi6Utdk= X-Google-Smtp-Source: AOwi7QArAIq3XqcSgJXjGDJXOfCCKnaWjiceKhKn+BS9G/3jLX5LpL0ZE/fqx/zC+Ue8R256zyjyDg== X-Received: by 10.200.12.69 with SMTP id l5mr16590043qti.268.1508186660233; Mon, 16 Oct 2017 13:44:20 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/3] Define __PTHREAD_MUTEX_HAVE_PREV for all architectures [BZ #22298] Date: Mon, 16 Oct 2017 18:44:11 -0200 Message-Id: <1508186653-24430-1-git-send-email-adhemerval.zanella@linaro.org> It is incorrect to define __PTHREAD_MUTEX_HAVE_PREV to 1 only when __WORDSIZE == 64. On x32, for instance, __PTHREAD_MUTEX_HAVE_PREV should be 1, but it has __WORDSIZE == 32. This patch defines __PTHREAD_MUTEX_HAVE_PREV for all architectures and its check is changed from "#ifdef" to "#if" to support values of 0 or 1. Checked on x86_64-linux-gnu and with a build for all major ABIs affected. H.J. Lu Adhemerval Zanella * nptl/allocatestack.c (allocate_stack): Check if __PTHREAD_MUTEX_HAVE_PREV is non-zero, instead if __PTHREAD_MUTEX_HAVE_PREV is defined. * nptl/descr.h (pthread): Likewise. * nptl/nptl-init.c (__pthread_initialize_minimal_internal): Likewise. * nptl/pthread_create.c (START_THREAD_DEFN): Likewise. * sysdeps/nptl/fork.c (__libc_fork): Likewise. * sysdeps/nptl/pthread.h (PTHREAD_MUTEX_INITIALIZER): Likewise. * sysdeps/nptl/bits/thread-shared-types.h (__pthread_internal_list, __pthread_mutex_s): Check __PTHREAD_MUTEX_HAVE_PREV instead of __WORDSIZE. * sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): New define. * sysdeps/alpha/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/arm/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/hppa/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/ia64/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/m68k/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/mips/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/nios2/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/s390/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/sh/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/sparc/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/tile/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. * sysdeps/x86/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_HAVE_PREV): Likewise. --- ChangeLog | 46 ++++++++++++++++++++++++ nptl/allocatestack.c | 2 +- nptl/descr.h | 2 +- nptl/nptl-init.c | 2 +- nptl/pthread_create.c | 4 +-- sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h | 5 +++ sysdeps/alpha/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/arm/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/hppa/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/ia64/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/m68k/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/mips/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/nios2/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/nptl/bits/thread-shared-types.h | 12 ++++--- sysdeps/nptl/fork.c | 2 +- sysdeps/nptl/pthread.h | 2 +- sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/s390/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/sh/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/sparc/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/tile/nptl/bits/pthreadtypes-arch.h | 1 + sysdeps/x86/nptl/bits/pthreadtypes-arch.h | 5 +++ 23 files changed, 83 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index ad9add8..1cc7893 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -753,7 +753,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, - offsetof (pthread_mutex_t, __data.__list.__next)); pd->robust_head.list_op_pending = NULL; -#ifdef __PTHREAD_MUTEX_HAVE_PREV +#if __PTHREAD_MUTEX_HAVE_PREV pd->robust_prev = &pd->robust_head; #endif pd->robust_head.list = &pd->robust_head; diff --git a/nptl/descr.h b/nptl/descr.h index c5ad0c8..c83b17b 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -169,7 +169,7 @@ struct pthread pid_t pid_ununsed; /* List of robust mutexes the thread is holding. */ -#ifdef __PTHREAD_MUTEX_HAVE_PREV +#if __PTHREAD_MUTEX_HAVE_PREV void *robust_prev; struct robust_list_head robust_head; diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c index 2921607..869e926 100644 --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -297,7 +297,7 @@ __pthread_initialize_minimal_internal (void) /* Initialize the robust mutex data. */ { -#ifdef __PTHREAD_MUTEX_HAVE_PREV +#if __PTHREAD_MUTEX_HAVE_PREV pd->robust_prev = &pd->robust_head; #endif pd->robust_head.list = &pd->robust_head; diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 992331e..51ae60d 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -518,7 +518,7 @@ START_THREAD_DEFN #ifndef __ASSUME_SET_ROBUST_LIST /* If this thread has any robust mutexes locked, handle them now. */ -# ifdef __PTHREAD_MUTEX_HAVE_PREV +# if __PTHREAD_MUTEX_HAVE_PREV void *robust = pd->robust_head.list; # else __pthread_slist_t *robust = pd->robust_list.__next; @@ -536,7 +536,7 @@ START_THREAD_DEFN __list.__next)); robust = *((void **) robust); -# ifdef __PTHREAD_MUTEX_HAVE_PREV +# if __PTHREAD_MUTEX_HAVE_PREV this->__list.__prev = NULL; # endif this->__list.__next = NULL; diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h index d13a75d..3c43707 100644 --- a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h @@ -45,6 +45,11 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#ifdef __ILP32__ +#define __PTHREAD_MUTEX_HAVE_PREV 0 +#else +#define __PTHREAD_MUTEX_HAVE_PREV 1 +#endif #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h index b6f6cb1..687028a 100644 --- a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h @@ -33,6 +33,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 1 #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h index 3f9eca4..fac38ac 100644 --- a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h @@ -34,6 +34,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 0 #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h index c158562..7ad0ce7 100644 --- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h @@ -48,6 +48,7 @@ pthread_mutex_t is larger than Linuxthreads. */ #define __PTHREAD_COMPAT_PADDING_END int __reserved[2]; #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 0 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__(16))) #define __ONCE_ALIGNMENT diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h index 631cb33..d456aba 100644 --- a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h @@ -33,6 +33,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 1 #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h index 845b9e6..25e93be 100644 --- a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h @@ -35,6 +35,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 0 #define __LOCK_ALIGNMENT __attribute__ ((__aligned__ (4))) #define __ONCE_ALIGNMENT __attribute__ ((__aligned__ (4))) diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h index d687e2c..b9130b6 100644 --- a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h @@ -35,6 +35,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 0 #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h index 6aa1bda..c5cc1f8 100644 --- a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h @@ -42,6 +42,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV (_MIPS_SIM == _ABI64) #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h index e2732f9..431da41 100644 --- a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h @@ -35,6 +35,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 0 #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h index 68b82b6..0d24529 100644 --- a/sysdeps/nptl/bits/thread-shared-types.h +++ b/sysdeps/nptl/bits/thread-shared-types.h @@ -59,7 +59,10 @@ /* Common definition of pthread_mutex_t. */ -#if __WORDSIZE == 64 +/* __PTHREAD_MUTEX_HAVE_PREV also defines the internal layout of + __pthread_mutex_s internal __nusers, __PTHREAD_SPINS_DATA, and + __list members. */ +#if __PTHREAD_MUTEX_HAVE_PREV typedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; @@ -74,7 +77,7 @@ typedef struct __pthread_internal_slist /* Lock elision support. */ #if __PTHREAD_MUTEX_LOCK_ELISION -# if __WORDSIZE == 64 +# if __PTHREAD_MUTEX_HAVE_PREV # define __PTHREAD_SPINS_DATA \ short __spins; \ short __elision @@ -101,17 +104,16 @@ struct __pthread_mutex_s int __lock __LOCK_ALIGNMENT; unsigned int __count; int __owner; -#if __WORDSIZE == 64 +#if __PTHREAD_MUTEX_HAVE_PREV unsigned int __nusers; #endif /* KIND must stay at this position in the structure to maintain binary compatibility with static initializers. */ int __kind; __PTHREAD_COMPAT_PADDING_MID -#if __WORDSIZE == 64 +#if __PTHREAD_MUTEX_HAVE_PREV __PTHREAD_SPINS_DATA; __pthread_list_t __list; -# define __PTHREAD_MUTEX_HAVE_PREV 1 #else unsigned int __nusers; __extension__ union diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c index 4bb87e2..48676c2 100644 --- a/sysdeps/nptl/fork.c +++ b/sysdeps/nptl/fork.c @@ -166,7 +166,7 @@ __libc_fork (void) inherit the correct value from the parent. We do not need to clear the pending operation because it must have been zero when fork was called. */ -# ifdef __PTHREAD_MUTEX_HAVE_PREV +# if __PTHREAD_MUTEX_HAVE_PREV self->robust_prev = &self->robust_head; # endif self->robust_head.list = &self->robust_head; diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 632ea7b..2b2b386 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -83,7 +83,7 @@ enum #endif -#ifdef __PTHREAD_MUTEX_HAVE_PREV +#if __PTHREAD_MUTEX_HAVE_PREV # define PTHREAD_MUTEX_INITIALIZER \ { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } } # ifdef __USE_GNU diff --git a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h index f29119b..d56897b 100644 --- a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h @@ -42,6 +42,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 1 +#define __PTHREAD_MUTEX_HAVE_PREV (__WORDSIZE == 64) #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h index 3a9ac57..e4c164a 100644 --- a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h @@ -45,6 +45,7 @@ #else #define __PTHREAD_MUTEX_LOCK_ELISION 0 #endif +#define __PTHREAD_MUTEX_HAVE_PREV (__WORDSIZE == 64) #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h index b2615fe..711e7bb 100644 --- a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h @@ -34,6 +34,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV 0 #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h index 1e188cf..6e7f47a 100644 --- a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h @@ -43,6 +43,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV (__WORDSIZE == 64) #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h index 145ee42..c753a9b 100644 --- a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h @@ -43,6 +43,7 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_HAVE_PREV (__WORDSIZE == 64) #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT diff --git a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h index fd86806..1df1e02 100644 --- a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h @@ -51,6 +51,11 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 1 +#ifdef __x86_64__ +# define __PTHREAD_MUTEX_HAVE_PREV 1 +#else +# define __PTHREAD_MUTEX_HAVE_PREV 0 +#endif #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT