From patchwork Thu Oct 19 21:00:05 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: 116437 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp933185qgn; Thu, 19 Oct 2017 14:01:17 -0700 (PDT) X-Received: by 10.99.95.201 with SMTP id t192mr2340286pgb.398.1508446877186; Thu, 19 Oct 2017 14:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508446877; cv=none; d=google.com; s=arc-20160816; b=Ww+IpWLQ1MngyJs3bhWWV19gAqS6Hxl5CDOVhLfIt0/jM42MRpgcxdJvkD08miIS05 8rsbnyjuccOQQ9UUl2hvABkZKe9dzhqc897YLWJvq+jhdUETvq7PnUMem+nse7mFfncg NDFUs90Qsz0t1WQKFtQ0HPw/3K/vkqJX99icUv47tezWMuhOvnKJhhoZgKKrh9tOBeq0 YtYdAnv6//MBzyLDuRd8ct4LEDJ+aGWCcenIuO+4roWEthRsm6nWAEuitXw8HWAFnwwM 6Wm8UlyH2nZSAiiPZMC5QF29c1lUR6XTDTCoAstybJH4+3HzYFO2TO6amNXAEF+0y/pt iQpQ== 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=7CrXA2lJ7VuA1a+rsUVuXdLtMfCM/vzpTXFkwkBZPG8=; b=05oUyw5MKB89UTDJkeBaIcciftTMHkNy5t/IoGkYzV5uGH1vpfIU10VRsZop5Sq6L7 aiUKxtNNgMd83rzmsBZBYN4YoldCNEA9g/s08JPRTc5UFqhhfsKg63zB2s8fqFISF1TW 6vby0q3k5miM3U7wSOPt1j8rE94z7Wg2F1mtqGpQaEqnV1wpzKdiyLlL2sDdTQIg4hWQ uWUCxi1/JuOGVL7eejI6qC5ZBzMyYhMnQE3UosWkzMbFD9JTjUcV+Nhs2YFpqegfO4tf GKudQMCaW+/Wr65cnqIKgd4yEsIOvqq6sHlZa0+L9ey/IzTHuIRkqOXA3ujd0QIWPWqp nYfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=A90G3ZaA; spf=pass (google.com: domain of libc-alpha-return-86152-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86152-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 m6si8315256pff.205.2017.10.19.14.01.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 14:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-86152-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=A90G3ZaA; spf=pass (google.com: domain of libc-alpha-return-86152-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86152-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=jxVbGlVQoNpd1Td+w6hNrPIdEtK/G/RnC0C9cGL2zoNUgQMe2iNEs dv1LK6qPXl+8z76iZ+31mzdC0XCsUlTJYpl1x0lh9zI5xFDHCFxulb2Eh43D8JN8 erqAzylxGAVPnj0vWia2PA001GlHO8YE+dH8CzTjjgt5GXEALhlzbQ= 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=Tu+TZvxaX6yYlOXYdzYkZuwY/5k=; b=A90G3ZaAf2YNjdS4XY+YbR9OQRcj CXRUs/C2rctPtTVPbbZRd8Ux063zcJRJ7vG+/KuEZK1PihYa/AjMvvmVYy4HewP7 SMXD1T006Gu43rKUeyu3ByeOF+8im9CvcXyJHGR4qBdJ44gzVOl4jjQrJ2XACeSS 95YDvMNlstGwAXk= Received: (qmail 92437 invoked by alias); 19 Oct 2017 21:00:42 -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 91109 invoked by uid 89); 19 Oct 2017 21:00:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 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 autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f194.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=7CrXA2lJ7VuA1a+rsUVuXdLtMfCM/vzpTXFkwkBZPG8=; b=T+Fw3kY5wC8Wny5oLFf97xBDaQqbYriaMdInn19ORxrrHup6Kshlw5cS1HOmKbe6as KNP1nOjWO7jgsTZBV0U1UMbp2OkgWtT7dOuzBY+F4ML9mH12MZaTeI78wbqT8mU6fW/W OwNjv9lGqsLNPcf0+fzxVraru1N7eXex94xTfdwP12klynROXEJkktOrU1DUAzsp5Egv 4yOWGt4RveLZWtrBqd9h+UQ9iP2g/uBQ1Zz16P8piFHJeTTnImcM88wLqL30+pgbSLDs B163TL+a2ZRvgii8sELhRlu+67ogELA+g93AWmkGx2D37lVqaltT5MCDUbUXJm7gLyH7 5mSQ== X-Gm-Message-State: AMCzsaVDfbRxWVYMIP7vZNHzZlGY2aTuqx4lP/4g5TAtDupsloffoKiz aspSx06aGSz8yp9t4XS8UMEeRHm/owQ= X-Google-Smtp-Source: ABhQp+TiRhKNR9hSwIoAN7vb9DOHQe2MGRd00hECyyBfH0EwThQdPv8vCCNRpD6H9qEtSgi8egYrJw== X-Received: by 10.200.48.151 with SMTP id v23mr3803947qta.97.1508446817665; Thu, 19 Oct 2017 14:00:17 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/3] nptl: Add tests for internal pthread_mutex_t offsets Date: Thu, 19 Oct 2017 19:00:05 -0200 Message-Id: <1508446807-21704-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds a new build test to check for internal fields offsets uses on pthread_mutex_t static initialization macros (PTHREAD_MUTEX_INITIALIZER, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, and PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP). Currently the only field which is statically initialized to a non zero value is pthread_mutex_t.__data.__kind value, however the test also check the offset of __kind, __spins, __elision (if support), and __list internal member. A internal header (pthread-offset.h) is added to each major ABI with the reference value. Checked on x86_64-linux-gnu and with a build check for all affected ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu, mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu, s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32, tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32). * nptl/Makefile (tests-internal): Add tst-offsets. * nptl/tst-offsets.c: New file. * sysdeps/aarch64/nptl/pthread-offsets.h: Likewise. * sysdeps/alpha/nptl/pthread-offsets.h: Likewise. * sysdeps/arm/nptl/pthread-offsets.h: Likewise. * sysdeps/hppa/nptl/pthread-offsets.h: Likewise. * sysdeps/i386/nptl/pthread-offsets.h: Likewise. * sysdeps/ia64/nptl/pthread-offsets.h: Likewise. * sysdeps/m68k/nptl/pthread-offsets.h: Likewise. * sysdeps/microblaze/nptl/pthread-offsets.h: Likewise. * sysdeps/mips/nptl/pthread-offsets.h: Likewise. * sysdeps/nios2/nptl/pthread-offsets.h: Likewise. * sysdeps/powerpc/nptl/pthread-offsets.h: Likewise. * sysdeps/s390/nptl/pthread-offsets.h: Likewise. * sysdeps/sh/nptl/pthread-offsets.h: Likewise. * sysdeps/sparc/nptl/pthread-offsets.h: Likewise. * sysdeps/tile/nptl/pthread-offsets.h: Likewise. * sysdeps/x86_64/nptl/pthread-offsets.h: Likewise. --- ChangeLog | 21 ++++++++++++ nptl/Makefile | 2 +- nptl/tst-offsets.c | 54 +++++++++++++++++++++++++++++++ sysdeps/aarch64/nptl/pthread-offsets.h | 5 +++ sysdeps/alpha/nptl/pthread-offsets.h | 5 +++ sysdeps/arm/nptl/pthread-offsets.h | 5 +++ sysdeps/hppa/nptl/pthread-offsets.h | 5 +++ sysdeps/i386/nptl/pthread-offsets.h | 5 +++ sysdeps/ia64/nptl/pthread-offsets.h | 5 +++ sysdeps/m68k/nptl/pthread-offsets.h | 5 +++ sysdeps/microblaze/nptl/pthread-offsets.h | 5 +++ sysdeps/mips/nptl/pthread-offsets.h | 13 ++++++++ sysdeps/nios2/nptl/pthread-offsets.h | 5 +++ sysdeps/powerpc/nptl/pthread-offsets.h | 15 +++++++++ sysdeps/s390/nptl/pthread-offsets.h | 15 +++++++++ sysdeps/sh/nptl/pthread-offsets.h | 5 +++ sysdeps/sparc/nptl/pthread-offsets.h | 15 +++++++++ sysdeps/tile/nptl/pthread-offsets.h | 15 +++++++++ sysdeps/x86_64/nptl/pthread-offsets.h | 5 +++ 19 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 nptl/tst-offsets.c create mode 100644 sysdeps/aarch64/nptl/pthread-offsets.h create mode 100644 sysdeps/alpha/nptl/pthread-offsets.h create mode 100644 sysdeps/arm/nptl/pthread-offsets.h create mode 100644 sysdeps/hppa/nptl/pthread-offsets.h create mode 100644 sysdeps/i386/nptl/pthread-offsets.h create mode 100644 sysdeps/ia64/nptl/pthread-offsets.h create mode 100644 sysdeps/m68k/nptl/pthread-offsets.h create mode 100644 sysdeps/microblaze/nptl/pthread-offsets.h create mode 100644 sysdeps/mips/nptl/pthread-offsets.h create mode 100644 sysdeps/nios2/nptl/pthread-offsets.h create mode 100644 sysdeps/powerpc/nptl/pthread-offsets.h create mode 100644 sysdeps/s390/nptl/pthread-offsets.h create mode 100644 sysdeps/sh/nptl/pthread-offsets.h create mode 100644 sysdeps/sparc/nptl/pthread-offsets.h create mode 100644 sysdeps/tile/nptl/pthread-offsets.h create mode 100644 sysdeps/x86_64/nptl/pthread-offsets.h -- 2.7.4 diff --git a/nptl/Makefile b/nptl/Makefile index d819349..7492b06 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -304,7 +304,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ tst-thread_local1 tst-mutex-errorcheck tst-robust10 \ tst-robust-fork tst-create-detached tst-memstream -tests-internal := tst-typesizes \ +tests-internal := tst-typesizes tst-offsets \ tst-rwlock19 tst-rwlock20 \ tst-sem11 tst-sem12 tst-sem13 \ tst-barrier5 tst-signal7 tst-mutex8 tst-mutex8-static \ diff --git a/nptl/tst-offsets.c b/nptl/tst-offsets.c new file mode 100644 index 0000000..0df1155 --- /dev/null +++ b/nptl/tst-offsets.c @@ -0,0 +1,54 @@ +/* Check pthread internal offsets. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +#include + +#define STR_HELPER(x) #x +#define STR(x) STR_HELPER(x) + +static int +do_test (void) +{ +#define TEST_OFFSET(type, member, offset) \ + _Static_assert (offsetof (type, member) == offset, \ + "offset of " #member " field of " #type " != " \ + STR (offset)) + + /* Check if internal fields in pthread_mutex_t used by static initializers + have the expected offset. */ + TEST_OFFSET (pthread_mutex_t, __data.__nusers, + __PTHREAD_MUTEX_NUSERS_OFFSET); + TEST_OFFSET (pthread_mutex_t, __data.__kind, + __PTHREAD_MUTEX_KIND_OFFSET); + TEST_OFFSET (pthread_mutex_t, __data.__spins, + __PTHREAD_MUTEX_SPINS_OFFSET); +#if __PTHREAD_MUTEX_LOCK_ELISION + TEST_OFFSET (pthread_mutex_t, __data.__elision, + __PTHREAD_MUTEX_ELISION_OFFSET); +#endif + TEST_OFFSET (pthread_mutex_t, __data.__list, + __PTHREAD_MUTEX_LIST_OFFSET); + + return 0; +} + +#include diff --git a/sysdeps/aarch64/nptl/pthread-offsets.h b/sysdeps/aarch64/nptl/pthread-offsets.h new file mode 100644 index 0000000..16c6b0d --- /dev/null +++ b/sysdeps/aarch64/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +#define __PTHREAD_MUTEX_KIND_OFFSET 16 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 24 diff --git a/sysdeps/alpha/nptl/pthread-offsets.h b/sysdeps/alpha/nptl/pthread-offsets.h new file mode 100644 index 0000000..16c6b0d --- /dev/null +++ b/sysdeps/alpha/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +#define __PTHREAD_MUTEX_KIND_OFFSET 16 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 24 diff --git a/sysdeps/arm/nptl/pthread-offsets.h b/sysdeps/arm/nptl/pthread-offsets.h new file mode 100644 index 0000000..9617354 --- /dev/null +++ b/sysdeps/arm/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/hppa/nptl/pthread-offsets.h b/sysdeps/hppa/nptl/pthread-offsets.h new file mode 100644 index 0000000..8ae01b9 --- /dev/null +++ b/sysdeps/hppa/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 32 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 36 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 36 diff --git a/sysdeps/i386/nptl/pthread-offsets.h b/sysdeps/i386/nptl/pthread-offsets.h new file mode 100644 index 0000000..9617354 --- /dev/null +++ b/sysdeps/i386/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/ia64/nptl/pthread-offsets.h b/sysdeps/ia64/nptl/pthread-offsets.h new file mode 100644 index 0000000..16c6b0d --- /dev/null +++ b/sysdeps/ia64/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +#define __PTHREAD_MUTEX_KIND_OFFSET 16 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 24 diff --git a/sysdeps/m68k/nptl/pthread-offsets.h b/sysdeps/m68k/nptl/pthread-offsets.h new file mode 100644 index 0000000..9617354 --- /dev/null +++ b/sysdeps/m68k/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/microblaze/nptl/pthread-offsets.h b/sysdeps/microblaze/nptl/pthread-offsets.h new file mode 100644 index 0000000..9617354 --- /dev/null +++ b/sysdeps/microblaze/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/mips/nptl/pthread-offsets.h b/sysdeps/mips/nptl/pthread-offsets.h new file mode 100644 index 0000000..0ac3eda --- /dev/null +++ b/sysdeps/mips/nptl/pthread-offsets.h @@ -0,0 +1,13 @@ +#if _MIPS_SIM == _ABI64 +# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +# define __PTHREAD_MUTEX_KIND_OFFSET 16 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 24 +#else +# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +# define __PTHREAD_MUTEX_KIND_OFFSET 12 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 20 +#endif diff --git a/sysdeps/nios2/nptl/pthread-offsets.h b/sysdeps/nios2/nptl/pthread-offsets.h new file mode 100644 index 0000000..9617354 --- /dev/null +++ b/sysdeps/nios2/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/powerpc/nptl/pthread-offsets.h b/sysdeps/powerpc/nptl/pthread-offsets.h new file mode 100644 index 0000000..bdda1f1 --- /dev/null +++ b/sysdeps/powerpc/nptl/pthread-offsets.h @@ -0,0 +1,15 @@ +#include + +#if __WORDSIZE == 64 +# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +# define __PTHREAD_MUTEX_KIND_OFFSET 16 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 24 +#else +# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +# define __PTHREAD_MUTEX_KIND_OFFSET 12 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 20 +#endif diff --git a/sysdeps/s390/nptl/pthread-offsets.h b/sysdeps/s390/nptl/pthread-offsets.h new file mode 100644 index 0000000..bdda1f1 --- /dev/null +++ b/sysdeps/s390/nptl/pthread-offsets.h @@ -0,0 +1,15 @@ +#include + +#if __WORDSIZE == 64 +# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +# define __PTHREAD_MUTEX_KIND_OFFSET 16 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 24 +#else +# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +# define __PTHREAD_MUTEX_KIND_OFFSET 12 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 20 +#endif diff --git a/sysdeps/sh/nptl/pthread-offsets.h b/sysdeps/sh/nptl/pthread-offsets.h new file mode 100644 index 0000000..9617354 --- /dev/null +++ b/sysdeps/sh/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +#define __PTHREAD_MUTEX_KIND_OFFSET 12 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 20 diff --git a/sysdeps/sparc/nptl/pthread-offsets.h b/sysdeps/sparc/nptl/pthread-offsets.h new file mode 100644 index 0000000..bdda1f1 --- /dev/null +++ b/sysdeps/sparc/nptl/pthread-offsets.h @@ -0,0 +1,15 @@ +#include + +#if __WORDSIZE == 64 +# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +# define __PTHREAD_MUTEX_KIND_OFFSET 16 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 24 +#else +# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +# define __PTHREAD_MUTEX_KIND_OFFSET 12 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 20 +#endif diff --git a/sysdeps/tile/nptl/pthread-offsets.h b/sysdeps/tile/nptl/pthread-offsets.h new file mode 100644 index 0000000..bdda1f1 --- /dev/null +++ b/sysdeps/tile/nptl/pthread-offsets.h @@ -0,0 +1,15 @@ +#include + +#if __WORDSIZE == 64 +# define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +# define __PTHREAD_MUTEX_KIND_OFFSET 16 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 24 +#else +# define __PTHREAD_MUTEX_NUSERS_OFFSET 16 +# define __PTHREAD_MUTEX_KIND_OFFSET 12 +# define __PTHREAD_MUTEX_SPINS_OFFSET 20 +# define __PTHREAD_MUTEX_ELISION_OFFSET 22 +# define __PTHREAD_MUTEX_LIST_OFFSET 20 +#endif diff --git a/sysdeps/x86_64/nptl/pthread-offsets.h b/sysdeps/x86_64/nptl/pthread-offsets.h new file mode 100644 index 0000000..16c6b0d --- /dev/null +++ b/sysdeps/x86_64/nptl/pthread-offsets.h @@ -0,0 +1,5 @@ +#define __PTHREAD_MUTEX_NUSERS_OFFSET 12 +#define __PTHREAD_MUTEX_KIND_OFFSET 16 +#define __PTHREAD_MUTEX_SPINS_OFFSET 20 +#define __PTHREAD_MUTEX_ELISION_OFFSET 22 +#define __PTHREAD_MUTEX_LIST_OFFSET 24 From patchwork Thu Oct 19 21:00:06 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: 116436 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp932890qgn; Thu, 19 Oct 2017 14:01:00 -0700 (PDT) X-Received: by 10.159.206.198 with SMTP id x6mr2434950plo.35.1508446860669; Thu, 19 Oct 2017 14:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508446860; cv=none; d=google.com; s=arc-20160816; b=LnocLNrTK1YbSIfj25+t5YQMO6AraaWVImTp+AU68lpu7NHuJEf0nA+5r/b652/S2d 6Lc0g3fzzo+CxM9rjO5LZcHW/borcTFfxsZybQ7rYvMwIVwyhfP8wmAb7kMDAtAju+ED zXKxOo2N0xPwfgoMKFPVMCjNbPPu4vo9MC5jmn2sUd8cpX6cvCfgCkKL2meccZH+1/3v iHOZGglTUuV9JNTvXxKYGADZ3QWjYznmCEISK44pndkLq89d996ooOlHF4y//hLvU/zN Mbk2I4xC6w6g2adjST4jLT8VLKc+t4EmUNFN7eP72J/J1RXoTijHiUf7Pyex0oXoPvOD AxqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=vcLy6mTbmx3qTJFjc/XbTmoN3uvrsvc2sIYM9GajkvE=; b=aDRk1/MNwLDwsxxaW/u/yv8IIf8DclxGKvMT6Z3wdTZWy6Uupn7AhU1uYkZRx5hn6P Z2Tsa75bNEuGE/eY3cEdHK6mFlDGGLhPj839vIS76ITULO6/jK7jaSdil7gzp7pRxkLc B9vE8UDWGm/OBZW4sjhIu2rTD+s683xIXvjc6L6RPQiyqHw4EtdxJ/7xEvniPLQLNFXt TFfkX+9r3mITqDrplw6VAuLWg2DHPzvbMivha0yF33jU6OhRzOEK36jduXAgj6TiNYRG SHr60EdbaB8UwHxN29RS4ZLS78schQLxioc0oDyBo7S+cgIrAoV7NxI3FkZtftlVFDjP fwwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=qzZhMrdW; spf=pass (google.com: domain of libc-alpha-return-86151-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86151-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 p73si9876716pfi.83.2017.10.19.14.01.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 14:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-86151-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=qzZhMrdW; spf=pass (google.com: domain of libc-alpha-return-86151-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86151-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:in-reply-to :references; q=dns; s=default; b=CgNMAy2S0o+GoiA/NTcH0brqUrZgMYb p7we08tC0ylz51O+jmb4V+ojyhpvKO3cNiIzBdPVEWrI4xraS1hdhpU/GqlW9F3D m6RohlbYD7Rv4NgCxR4SCdfMgItuxepMhm3nqUHrU5iVOVQrWbdaR3UA4jEfH4LL zfrPoAxR2IbA= 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:in-reply-to :references; s=default; bh=ni07b+AW4jpa2nzooWysK3kjEdw=; b=qzZhM rdWxwS0gej2qdnJytwPiB25YIUeLFG0IGyUHnxqTQUiBqRZSVJJhm8NllEZO392M bznKdQ+Sar8LeR3MpG7dgCjMFiZqT9QOFKL5fta3bw8LauGkT1itXaYl+8x300MJ fL4Oa6mRF1IdSx97Yp9BAdWrs/UjW0EPJR/hBo= Received: (qmail 92403 invoked by alias); 19 Oct 2017 21:00:42 -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 91041 invoked by uid 89); 19 Oct 2017 21:00:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 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 autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f194.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:in-reply-to :references; bh=vcLy6mTbmx3qTJFjc/XbTmoN3uvrsvc2sIYM9GajkvE=; b=cdbn5YKoCvK9uMXtRiLDO8vF7u8fNO6151b4J+u6xXj7v+xx/fImtc9p7Pczw9W3gB WoCilnAdtPsMhUXvM3QUIHKt5AkfCJ64xJTyHFmHHC3Rf/LCzLhX7HILeIUuhOsgL+uI X/hZHst5rdp5RXff4/z5h/EbXGzc7lYg7W6npFaQSmFgjrkwG6zJY208kAVJMlvMqjJL PjEcHsOuvlkDonVPW8tZn09BGkdRj5aP9d8WI1JRsWrY8dQIOH2sR0Hxmdp5bgxy7poW AfDAVO4yBTShZNIU8j0QfPFZi6GTp2CR2okO+sIQddeHAW9L+9lnFAu9YWolO8JjpZNL qvjg== X-Gm-Message-State: AMCzsaUSTzcv2F3rgzEhY50ldonv5vL2KPluYW88fmN2WkPQs7Mu8/qY 5tfNPjQkcFrRgUsxMVYqKKiQl9QW2pA= X-Google-Smtp-Source: ABhQp+Q6dks+kDm7qjt+HTSOgKrNHdlC/CocQNo1FAqlWYxRzAjK8zR/NF7rF++Ae+cJWrPrHyLQyg== X-Received: by 10.200.25.78 with SMTP id g14mr4052467qtk.225.1508446819031; Thu, 19 Oct 2017 14:00:19 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/3] nptl: Change tst-typesizes to _Static_assert Date: Thu, 19 Oct 2017 19:00:06 -0200 Message-Id: <1508446807-21704-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1508446807-21704-1-git-send-email-adhemerval.zanella@linaro.org> References: <1508446807-21704-1-git-send-email-adhemerval.zanella@linaro.org> Instead of rely on runtime check to assure correct pthread types size a better strategy would use _Static_assert to trigger an error on build time (and thus allowing to check to potentially ABI breakage on cross-compiling make check). Checked on x86_64-linux-gnu and with a build check for all affected ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf, hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu, mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu, s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32, tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32). * nptl/tst-typesizes.c: Make sizes check _Static_asserts at built time. --- ChangeLog | 3 ++ nptl/tst-typesizes.c | 77 +++++++++++++--------------------------------------- 2 files changed, 22 insertions(+), 58 deletions(-) -- 2.7.4 diff --git a/nptl/tst-typesizes.c b/nptl/tst-typesizes.c index 78ed773..3355614 100644 --- a/nptl/tst-typesizes.c +++ b/nptl/tst-typesizes.c @@ -20,56 +20,26 @@ #include #include -static const struct -{ - const char *name; - size_t expected; - size_t is; -} types[] = - { -#define T(t, c) \ - { #t, c, sizeof (t) } - T (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T), - T (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T), - T (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T), - T (pthread_cond_t, __SIZEOF_PTHREAD_COND_T), - T (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T), - T (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T), - T (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T), - T (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T), - T (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T) - }; - static int do_test (void) { - int result = 0; - -#define TEST_TYPE(name) \ - printf ("%s: ", #name); \ - if (sizeof (name) != sizeof (((name *) 0)->__size)) \ - { \ - printf ("expected %zu, is %zu\n", \ - sizeof (((name *) 0)->__size), sizeof (name)); \ - result = 1; \ - } \ - else \ - puts ("OK") - - TEST_TYPE (pthread_mutex_t); - TEST_TYPE (pthread_cond_t); - TEST_TYPE (pthread_rwlock_t); - -#define TEST_TYPE2(name, internal) \ - printf ("%s: ", #name); \ - if (sizeof (((name *) 0)->__size) < sizeof (internal)) \ - { \ - printf ("expected %zu, is %zu\n", \ - sizeof (((name *) 0)->__size), sizeof (internal)); \ - result = 1; \ - } \ - else \ - puts ("OK") +#define TEST_TYPE(__type, __size) \ + _Static_assert (sizeof (__type) == __size, \ + "sizeof (" #__type ") != " #__size) + + TEST_TYPE (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T); + TEST_TYPE (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T); + TEST_TYPE (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T); + TEST_TYPE (pthread_cond_t, __SIZEOF_PTHREAD_COND_T); + TEST_TYPE (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T); + TEST_TYPE (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T); + TEST_TYPE (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T); + TEST_TYPE (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T); + TEST_TYPE (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T); + +#define TEST_TYPE2(__type, __internal) \ + _Static_assert (sizeof ((__type *) 0)->__size >= sizeof (__internal), \ + "sizeof (" #__type ".__size) > sizeof (" #__internal ")") TEST_TYPE2 (pthread_attr_t, struct pthread_attr); TEST_TYPE2 (pthread_mutexattr_t, struct pthread_mutexattr); @@ -80,16 +50,7 @@ do_test (void) TEST_TYPE2 (sem_t, struct new_sem); TEST_TYPE2 (sem_t, struct old_sem); - for (size_t i = 0; i < sizeof (types) / sizeof (types[0]); ++i) - if (types[i].expected != types[i].is) - { - printf ("%s: expected %zu, is %zu\n", - types[i].name, types[i].expected, types[i].is); - result = 1; - } - - return result; + return 0; } -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include From patchwork Thu Oct 19 21:00:07 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: 116438 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp933466qgn; Thu, 19 Oct 2017 14:01:33 -0700 (PDT) X-Received: by 10.99.95.70 with SMTP id t67mr2368824pgb.409.1508446893092; Thu, 19 Oct 2017 14:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508446893; cv=none; d=google.com; s=arc-20160816; b=dICKMh1K9C1/rROvZ7ZJkYYwzTJY659IcC3gEEntug0b0Ei4USfa2JBgPO57Mq6LQ6 Jvrwg2VH4yRRcNItem+rGF6u3tKxK5u3CBMSqgfXg7V5WgB7L88Mcqv4let3Rc2sMkpU k+3GZ8GvwIcDS6qoi+nIED6WaC8QnXVrYF6X0OabmTFSe1hxPGx53evNv53INTfCsRIB QY0VqEA3i3zrLKcIr52UHBI1bBphFJJLUSZajUuvYeb8N/PIyIbLOEWL63Rfq2GZ1cFL Nl5QbFsbt07H1Zi5gLa897o7/tS/DVmR1M3CNkohbLjgoPCTPitENfhr/opAP1TKfRWx pLqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=PWHsWizfi7BF1pn1DXlnm3dtjS21V4Phk3Z/KoiDDaM=; b=qtzQ1U9klMppg5C7W0rnn//zu1RSyKxdAlroNMArRGmDkSSQRIfJnM25nKMxtCxRx5 QHl26RLE+9KUSxhz6iQ2VjwhGRGPriOh9vnMybWSgm0iBkWGb673L+QEit1PuccqYBoX MEKz3nsj8ht0w1RlY7CLJ7n8B8yqoH/VTeFk40OyyZk9UG/YvLyDQd1sXB5t9zJZ8mW4 bimSW/Vref5y80ZAKcYL+2K2QiEUQXhVPtrYV3BzIfQMnI+JfCSY4Fw0BQtbz+BiEtaR 6W9YiAfY/GHGaDcfJSCIZhox1VGFMJUhEB3kciyMnTGMcn74yJLdl7tu6DJGdYub7cUm TlfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=yl5akviR; spf=pass (google.com: domain of libc-alpha-return-86153-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86153-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 t2si5988193pgb.296.2017.10.19.14.01.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 14:01:33 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-86153-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=yl5akviR; spf=pass (google.com: domain of libc-alpha-return-86153-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86153-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:in-reply-to :references; q=dns; s=default; b=vcELWIu31qhmOS6rvv97vtKhTD6yagN 8erIpRvxIMohJ7p7Oh9/H4spj7FqXO3KF4BebIvA7DeqWPA5p0oR0iiEM8D/0rlU IblzuOLKbXJi126WAkpGTAQ/XaNO5Df5gH90+x7wlomeRmocPxVHNACnbLNWEb5I dT4R5mmozT/U= 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:in-reply-to :references; s=default; bh=16VBAUHNpzEkMEZTb0QdwNRrPn0=; b=yl5ak viR2NCN/4ruiXH3FnyStToLKZ6ZoMn/VvbXL1fTN0LYyq/AlIVt+Z7U7Doj4nqMi V4d4DcHqmE+/UXWNpoCi65jqEvj4ijpm3AYt5ylkOLDlsQpn630gyP+2px+++t2G Nfr4OEATq2VIgAFhltCWkKdFufQkLGguJlmBC8= Received: (qmail 92528 invoked by alias); 19 Oct 2017 21:00:43 -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 91954 invoked by uid 89); 19 Oct 2017 21:00:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 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 autolearn=ham version=3.3.2 spammy=4225 X-HELO: mail-qt0-f194.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:in-reply-to :references; bh=PWHsWizfi7BF1pn1DXlnm3dtjS21V4Phk3Z/KoiDDaM=; b=HrgYI5pYnPa+mV/iUlVf05jelb1+z8/WLzhfVWkGXG02Ykn8BEHGod7WoqymkAzgwx YMPpWbCNdze088HGbTsLHM0MEXb7HZSR8IlQbnS9BrrxpMNiFD9o2RmoJ9obLWAU0AZQ apKBXzEVQqWLRuwJwvdumKVZc0uo/uFG1BXMfiYKhHxeHcEQw/QqHVZmgKlVdI3dLYTb f9cWQF+ihYhJPX1XaXPJhpIyYxIvbvaLkUo34ZlwTbjNHf4gP38O1ICH4JWYk7SAo4Jm fFXnU1t1/FDhucmWvtouDkzuDI/GiONFEm9HENU24jmyH2Dtr8GdCGzzQ7I1XmUaGSuq VQyQ== X-Gm-Message-State: AMCzsaWjmX4aIyL78/zJ3ix73MhZdF2KEyOj9P9R7WV+2JY0GHeqhk4Z NgOqT6KaZ+aIP8qI46w5QgcyWhOHOPw= X-Google-Smtp-Source: ABhQp+T6kYJYuw2b5YnyiiLwhH30XO93npBXwi9AXr/v5IJtDjgfGhuFud1PQETzTTCSBxsr0T2+cA== X-Received: by 10.237.34.82 with SMTP id o18mr3902563qtc.19.1508446820421; Thu, 19 Oct 2017 14:00:20 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 3/3] nptl: Define __PTHREAD_MUTEX_{NUSERS_AFTER_KIND, USE_UNION} Date: Thu, 19 Oct 2017 19:00:07 -0200 Message-Id: <1508446807-21704-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1508446807-21704-1-git-send-email-adhemerval.zanella@linaro.org> References: <1508446807-21704-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds two new internal defines to set the internal pthread_mutex_t layout required by the supported ABIS: 1. __PTHREAD_MUTEX_NUSERS_AFTER_KIND which control whether to define __nusers fields before or after __kind. The preferred value for is 0 for new ports and it sets __nusers before __kind. 2. __PTHREAD_MUTEX_USE_UNION which control whether internal __spins and __list members will be place inside an union for linuxthreads compatibility. The preferred value is 0 for ports and it sets to not use an union to define both fields. It fixes the wrong offsets value for __kind value on x86_64-linux-gnu-x32. Checked with a make check run-built-tests=no on all afected ABIs. [BZ #22298] * 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_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. (__pthread_internal_list): Check __PTHREAD_MUTEX_USE_UNION instead of __WORDSIZE for internal layout. (__pthread_mutex_s): Check __PTHREAD_MUTEX_NUSERS_AFTER_KIND instead of __WORDSIZE for internal __nusers layout and __PTHREAD_MUTEX_USE_UNION instead of __WORDSIZE whether to use an union for __spins and __list fields. (__PTHREAD_MUTEX_HAVE_PREV): Define also for __PTHREAD_MUTEX_USE_UNION case. * sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/alpha/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/arm/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/hppa/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/ia64/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/m68k/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/mips/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/nios2/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/s390/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/sh/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/sparc/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/tile/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. * sysdeps/x86/nptl/bits/pthreadtypes-arch.h (__PTHREAD_MUTEX_NUSERS_AFTER_KIND, __PTHREAD_MUTEX_USE_UNION): New defines. --- ChangeLog | 67 ++++++++++++++++++++++++ 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 | 2 + sysdeps/alpha/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/arm/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/hppa/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/ia64/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/m68k/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/mips/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/nios2/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/nptl/bits/thread-shared-types.h | 30 +++++++++-- sysdeps/nptl/fork.c | 2 +- sysdeps/nptl/pthread.h | 2 +- sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/s390/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/sh/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/sparc/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/tile/nptl/bits/pthreadtypes-arch.h | 2 + sysdeps/x86/nptl/bits/pthreadtypes-arch.h | 7 +++ 23 files changed, 135 insertions(+), 11 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..9ab23d0 100644 --- a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h @@ -45,6 +45,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 +#define __PTHREAD_MUTEX_USE_UNION 0 #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..429df10 100644 --- a/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h @@ -33,6 +33,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 +#define __PTHREAD_MUTEX_USE_UNION 0 #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..3911c81 100644 --- a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h @@ -34,6 +34,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +#define __PTHREAD_MUTEX_USE_UNION 1 #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..865a14e 100644 --- a/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h @@ -48,6 +48,8 @@ pthread_mutex_t is larger than Linuxthreads. */ #define __PTHREAD_COMPAT_PADDING_END int __reserved[2]; #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +#define __PTHREAD_MUTEX_USE_UNION 1 #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..2a3bc75 100644 --- a/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h @@ -33,6 +33,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 +#define __PTHREAD_MUTEX_USE_UNION 0 #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..966cc75 100644 --- a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h @@ -35,6 +35,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +#define __PTHREAD_MUTEX_USE_UNION 1 #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..e44f2dc 100644 --- a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h @@ -35,6 +35,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +#define __PTHREAD_MUTEX_USE_UNION 1 #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..f03389a 100644 --- a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h @@ -42,6 +42,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (_MIPS_SIM != _ABI64) +#define __PTHREAD_MUTEX_USE_UNION (_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..83f8684 100644 --- a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h @@ -35,6 +35,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +#define __PTHREAD_MUTEX_USE_UNION 1 #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..26073f8 100644 --- a/sysdeps/nptl/bits/thread-shared-types.h +++ b/sysdeps/nptl/bits/thread-shared-types.h @@ -42,6 +42,25 @@ the internal structure. __PTHREAD_MUTEX_LOCK_ELISION - 1 if the architecture supports lock elision or 0 otherwise. + __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers. The + preferred value for new architectures + is 0. + __PTHREAD_MUTEX_USE_UNION - control whether internal __spins and + __list will be place inside an union for + linuxthreads compatibility. + The preferred value for new architectures + is 0. + + For a new port the preferred values for the required defines are: + + #define __PTHREAD_COMPAT_PADDING_MID + #define __PTHREAD_COMPAT_PADDING_END + #define __PTHREAD_MUTEX_LOCK_ELISION 0 + #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 + #define __PTHREAD_MUTEX_USE_UNION 0 + + __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to + eventually support lock elision using transactional memory. The additional macro defines any constraint for the lock alignment inside the thread structures: @@ -59,7 +78,7 @@ /* Common definition of pthread_mutex_t. */ -#if __WORDSIZE == 64 +#if !__PTHREAD_MUTEX_USE_UNION typedef struct __pthread_internal_list { struct __pthread_internal_list *__prev; @@ -74,7 +93,7 @@ typedef struct __pthread_internal_slist /* Lock elision support. */ #if __PTHREAD_MUTEX_LOCK_ELISION -# if __WORDSIZE == 64 +# if !__PTHREAD_MUTEX_USE_UNION # define __PTHREAD_SPINS_DATA \ short __spins; \ short __elision @@ -101,24 +120,27 @@ struct __pthread_mutex_s int __lock __LOCK_ALIGNMENT; unsigned int __count; int __owner; -#if __WORDSIZE == 64 +#if !__PTHREAD_MUTEX_NUSERS_AFTER_KIND 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_USE_UNION __PTHREAD_SPINS_DATA; __pthread_list_t __list; # define __PTHREAD_MUTEX_HAVE_PREV 1 #else +# if __PTHREAD_MUTEX_NUSERS_AFTER_KIND unsigned int __nusers; +# endif __extension__ union { __PTHREAD_SPINS_DATA; __pthread_slist_t __list; }; +# define __PTHREAD_MUTEX_HAVE_PREV 0 #endif __PTHREAD_COMPAT_PADDING_END }; 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..8158cb5 100644 --- a/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h @@ -42,6 +42,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 1 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) +#define __PTHREAD_MUTEX_USE_UNION (__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..1ae2773 100644 --- a/sysdeps/s390/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/s390/nptl/bits/pthreadtypes-arch.h @@ -45,6 +45,8 @@ #else #define __PTHREAD_MUTEX_LOCK_ELISION 0 #endif +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) +#define __PTHREAD_MUTEX_USE_UNION (__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..e707751 100644 --- a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h @@ -34,6 +34,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +#define __PTHREAD_MUTEX_USE_UNION 1 #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..0f96f37 100644 --- a/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h @@ -43,6 +43,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) +#define __PTHREAD_MUTEX_USE_UNION (__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..054474f 100644 --- a/sysdeps/tile/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/tile/nptl/bits/pthreadtypes-arch.h @@ -43,6 +43,8 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 0 +#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) +#define __PTHREAD_MUTEX_USE_UNION (__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..74d5f6d 100644 --- a/sysdeps/x86/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/x86/nptl/bits/pthreadtypes-arch.h @@ -51,6 +51,13 @@ #define __PTHREAD_COMPAT_PADDING_MID #define __PTHREAD_COMPAT_PADDING_END #define __PTHREAD_MUTEX_LOCK_ELISION 1 +#ifdef __x86_64__ +# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 +# define __PTHREAD_MUTEX_USE_UNION 0 +#else +# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 +# define __PTHREAD_MUTEX_USE_UNION 1 +#endif #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT