From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70041.outbound.protection.outlook.com [40.107.7.41]) by sourceware.org (Postfix) with ESMTPS id 89C523857B89 for ; Fri, 29 Jul 2022 13:39:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 89C523857B89 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=X1hWIIze9fEFtB1wUObgow5humGQLgbizS6hDE/mweKcePTFQiiMkngm/IyeNWiCHESjn12jbnra4gc9ApB2TsMT8WAMWlFi+C51DfCCSmV+77EueDLq5vNr+A6yS7G55cLWfztowtzgHo/4cBdtlMADRFs+jSuSEZLhvE2eDK9CldabVUr2bYlxDrn9gZBjZOBWvbq4K5JeYX4AKAygJVNspC2kfWGxGpR4LdzJVf2Jiz2JVTqVi6xvHEr/Hu+Mvku108PMe+0/WONITPuVi0BweqnSlMkn2+LeqiCxSdpVMKrP3P2c7dIMkZwoFA2IFpyF/xdURlRHx6LcXpPbqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0nYMeIOTgLaASgNexFf6Foo/5sKpl7ui5nQ+eRprgWk=; b=C4IPi8UQNA/wTTV1+3YZhk5omoBBBytMyRHy9+u8Qthdp89QVPJiq+X7ZWqClVsdxnLlZ3N8tizIX7w1BQ5C7Y2LsplvttvoY6QGeFRoPqRQH7A7+5JNFSC+srZwWjJou9i1Ld3vzdZPaYJ4Csdg9UF7oou8wzYoIhYU/ifiFQTw9Q4eobYoB/dPWToFHEkncu5jrQ2nZFJ9EtSD8rVGcHGNvcrk25HLDG0HJp9cGlzog0Pa2506d0Bfvb/000YUZOVLeBzGyz6jbk8T4ZAGvJ3V2negUc1XnHyuiucFeh6a+nxa0WWfIaAOLc2V9d0A3lPmZqg6n0QnO9NUJo3tKg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AS9PR0301CA0009.eurprd03.prod.outlook.com (2603:10a6:20b:468::16) by HE1PR08MB2812.eurprd08.prod.outlook.com (2603:10a6:7:34::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.23; Fri, 29 Jul 2022 13:39:21 +0000 Received: from AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:468:cafe::25) by AS9PR0301CA0009.outlook.office365.com (2603:10a6:20b:468::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Fri, 29 Jul 2022 13:39:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT024.mail.protection.outlook.com (10.152.16.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Fri, 29 Jul 2022 13:39:21 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Fri, 29 Jul 2022 13:39:21 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d3838e8ae1c26c9e X-CR-MTA-TID: 64aa7808 Received: from 6b0c9747a7d8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C920A499-3149-4C1A-BCEC-6AFA0D599575.1; Fri, 29 Jul 2022 13:39:13 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6b0c9747a7d8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 29 Jul 2022 13:39:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TzD7BEc7eGQu7Q+M9iUbwdfDjyZQdvXAj86HwjafQn8/Rc4OylJsFUCkR5L4zRvLpOqNrBOT+A4dDw8WI9shVhhTWXuQeWcwt1ET0me/5Li/h8+UFVj4eMhSoPXaV1j1jTQlW7DKa2Wy+K7YdlNiw1sl9wpQP473wXct3Md8GS+FOV2TUXgsEyDSgvCNYhHgV3d7lLszpzP7uJCcRAoDaNvZoun+egpruKDS6CtCxX9qtXtEkNDQMD0LfVC6Mmatrpksh8Xu1s8L1T5rJxW+4+1lBHf2jVGrhH4C+b6HGSl7xO3kH+nbmm3/N1QABadzsJzfvA3mwKBywHbqbXAoUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0nYMeIOTgLaASgNexFf6Foo/5sKpl7ui5nQ+eRprgWk=; b=ob+D05ACOOSP4RPWre2vVdvTCX4ARXjOnrxMv8GvcmfN0PMkuGhnLbk7wlSr1eU5c4Os+zvb1X9y2oGysir2OSBHgyWm/WBwR7Se4kKTf3gtQ4bUTNxHs9OjiSwPezxIK5e595ZoU7fZiAH+Ic38iOXkcx9XvukzmgmPe2E4E7Myt8zD8fWtYJ+dprInnr+56jdUo7aWkIudmjY4U0yRt+X09PNnPFdAlJgipIvyOMQBo392fTA8py1QePQIWP4JBUanOzCn5QnNo/I8+D371rtabidC0Xv4HgSjbxRlej5UkGmhLqSelfSjiBXXWXxPSSanRh8+kKL4tWl8gDXz9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from AM5PR0801MB1668.eurprd08.prod.outlook.com (2603:10a6:203:3c::14) by DB6PR0802MB2232.eurprd08.prod.outlook.com (2603:10a6:4:83::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 29 Jul 2022 13:39:09 +0000 Received: from AM5PR0801MB1668.eurprd08.prod.outlook.com ([fe80::845f:5b9c:410a:f581]) by AM5PR0801MB1668.eurprd08.prod.outlook.com ([fe80::845f:5b9c:410a:f581%5]) with mapi id 15.20.5482.011; Fri, 29 Jul 2022 13:39:09 +0000 From: Wilco Dijkstra To: Florian Weimer , Wilco Dijkstra via Libc-alpha Subject: Re: [PATCH] Remove atomic-machine headers Thread-Topic: [PATCH] Remove atomic-machine headers Thread-Index: AQHYoo5VF3NgiY3ysUGfaI8wv0QDOq2T94nKgAFh3WA= Date: Fri, 29 Jul 2022 13:39:09 +0000 Message-ID: References: <87czdpyzoh.fsf@oldenburg.str.redhat.com> In-Reply-To: <87czdpyzoh.fsf@oldenburg.str.redhat.com> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-MS-Office365-Filtering-Correlation-Id: 166e1bbc-aab5-437e-8b3f-08da7167be3b x-ms-traffictypediagnostic: DB6PR0802MB2232:EE_|AM5EUR03FT024:EE_|HE1PR08MB2812:EE_ x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: /yCgSJlQPZKRfSXTYIrIWQEAymsYMVm3yLS9tPEIwIPwJPm5iZzg4Rq4+khz09nYhpBanQrvMJpokkaWmLcTh+IcIGT9y6TU5iwk7sAJDWhaluUhUXj/UWc/fgo2ZX3SvB3PyI6JrRNa1TkOdBpI2jdJpGIP5A9iEb6r1t5AxemGQva2FGjlBxiVR48nUylMydcYD/LYE+J1jx/Hao1mL3QAVXoBgMnaaOpyezfmyFdqXF+xoMqlNEdaQsAXo4wDA7a3f5il0zLuLdr1Op8bbi+ZmI3sZsez5oh4Q1XLLWPn7e61kC9OAy8pDt/mTLRpB+TSwNYOO7mqAc3SVb09bJRckWMoEn8ixQwlYe9Hhm99NeGxP7UiAu7mkH5vA7eftMNQ2+CJxTJ9g8OF2/p4GFizPR++qMhRZBW2Na6LMVOZNCtuZyGnHrhe8heGIgwCGzscOgnaBcZJS/dBfhlsRWQPrF8BFNrr8P6cgbPsYVfOZIZgnuVrLWd2dnFzJ5CSP/8K/TbQfy9nrTnUrXkqlhaCGT9Wj1Rij/X6PMzlywpUbQ5E7DJh/6sVManhTMmUnQ2BwGnbuL+RPsZTGy2fkGsCwFxKamjrG1AAnZVbyap7LU3yMHyq4tVoS2mQKlBUW9PuA6UGnzB6SPrYwpaUVWWn77BWxmN02WdVPjNGrvPk2MaihR9B6zzUz8AQfTe2dxU0WBxw+lI5vNIkyGv3DLI9KIJoX/dDOyBQnvue5D6LGyrgAz+5Bn/xf8bwsocNt5WDlY+JvbWS6OCfTZvZk+cWITz1F8yICiyTfYJ0JUD4ke5ze8Vmj7I/xqxn5e8G4payWVkkoeNiesLnGwHHemMzwLNTP9bUKzwPAFfDP97e1iMOJT+ohoBfY5BWbMNX X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM5PR0801MB1668.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(136003)(376002)(366004)(346002)(39860400002)(52536014)(122000001)(8936002)(478600001)(8676002)(64756008)(66556008)(110136005)(5660300002)(186003)(66476007)(91956017)(316002)(76116006)(66446008)(30864003)(66946007)(38100700002)(2906002)(7696005)(33656002)(71200400001)(26005)(41300700001)(9686003)(55016003)(83380400001)(6506007)(38070700005)(86362001)(2004002)(21314003)(579004)(559001); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2232 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 52df0f2a-049b-47bf-0788-08da7167b6e7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M1J0dcTUNNA3cvdkfMgEa6T2hAaZYGJO1k7eAHCsQRi+saGGWSmZ6SDoiWSdqvM2A1xa/6KfvXGH0N4tMK+NLSgyUbrQ+YiJ0vLH17rxkNO1CRfXuIyTx19NExJ5s3xqa0+Xw4BWpoANaGXTYCfKZr9oDOfm9d6o9Bl3F2EykCdSUvU3+1Vo4RN8XOT/nk7Uva58Bi0QhzQs4HTTvtDzq5pfneC6M3qoWGAMIKfCG4b5FzdhAsoD1TH7fTMoXIBnr/8r1Muf3rRVkPmlF5JqoDiEOFXhR/RDT+2QRnR/hxyeB5ePT6uvmxcLEmq6NolKg0xgi7JN61EBBcb+d5hgbnGA0wAaGMABbEq13HzIgxEEJftPsxIchWOhVtSUL2/RKyEf4KbO7aGzmH3TgAD0xNaa5u9cOhm1vdwqZlBelXSUBsbOJJL4i5doB56qgd4LvSodpMkANSBnnPL4FKAiWMTo+SWOYL54xoouALP9OsDjurryUXp9Pn+xBAvz4W34EzTPEmHez9EUhDcV1fTZJS0CDSU5zjic5Znh/oflQ7hOCvXDQAhE1tkJV0nBn2z0UykUSKsvLvAE1c5DMEeXXnlRRZBymt9tkkI2bXBRnjqfB90FOaV++4zAOS7zZ9oLikXWCt80TA2z6TKi+Cp4UVoi8C3od5bdGnAFYYLHCT9lLhhy3GUSIg6eO4MRkVcXwSSq2nnuHCmdL4bcYZzrNhqBbkzcoxpkv3eJq8iIJVO+oCbpkJETc96xIuAF8drPhUAcj1CHTToy0+J2WZZka9zGdVMY2pPcFi4wvV4Bo/a3kdyPWPOTlq207SufZaBtBwLVeBFsrLT6CfIZCCfuP9wEjZCRHMTA+nq7TXiUWgS3a/Hvjyed+ssB3tnpEAN1 X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(346002)(39860400002)(396003)(40470700004)(46966006)(36840700001)(36860700001)(110136005)(316002)(26005)(30864003)(6506007)(186003)(7696005)(9686003)(41300700001)(40460700003)(5660300002)(82310400005)(70206006)(40480700001)(86362001)(52536014)(55016003)(8676002)(8936002)(81166007)(336012)(356005)(478600001)(70586007)(83380400001)(47076005)(33656002)(2906002)(82740400003)(2004002)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 13:39:21.2708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 166e1bbc-aab5-437e-8b3f-08da7167be3b X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR08MB2812 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2022 13:39:34 -0000 Hi Florian,=0A= =0A= >> +runstatedir=0A= >=0A= > Spurious difference.=0A= =0A= I've removed it from v2, but it reappears whenever I run autoconf...=0A= =0A= > Can you use _static_assert, given that it's supposed to yield a=0A= > compile-time constant?=0A= =0A= Yes that works fine. I've also used that in include/atomic.h so you get bet= ter=0A= error messages if it does fail.=0A= =0A= > I'd be suprised if __atomic_always_lock_free is correct on all=0A= > glibc-supported architectures, though.=0A= =0A= It passes build-many-glibcs, so it works well enough. I double-checked the= =0A= config output, and it is as expected: 64-bit targets say yes, 32-bit target= s say no=0A= except for armv7-a (which is correct).=0A= =0A= > -/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the= =0A= > -=A0=A0 i386 psABI supplement provides only 4-byte alignment for uint64_t= =0A= > -=A0=A0 inside structs, so it is currently not possible to use 64-bit=0A= > -=A0=A0 atomics on this platform.=A0 */=0A= =0A= > Please preserve this comment somewhere.=A0 Maybe folod it into the=0A= > configure test example.=0A= =0A= This comment is in the configure test:=0A= =0A= > + /* Use address of structure with 64-bit type. This avoids incorrect= =0A= > + implementations which return true even if long long is not 64-bit a= ligned.=0A= > + This works on GCC and LLVM - other cases have bugs and they disagre= e. */=0A= =0A= This is more generic since unaligned 64-bit types are common on many 32-bit= targets.=0A= =0A= Cheers,=0A= Wilco=0A= =0A= v2: Add llongarch, fix leon3, use _Static_assert=0A= =0A= Remove the last few unnecessary defines from all the atomic-machine headers= so almost=0A= all can be removed. Set __HAVE_64B_ATOMICS as part of configure - this is n= ot only=0A= simpler but also more correct since it depends on the compiler and settings= . Note that=0A= __atomic_always_lock_free is quite buggy, but the expression used works cor= rectly,=0A= including on LLVM. Remove the odd ATOMIC_EXCHANGE_USES_CAS as it is only us= ed once and=0A= set incorrectly by many targets.=0A= =0A= Passes regress on AArch64 and buildmanyglibc.=0A= =0A= ---=0A= diff --git a/config.h.in b/config.h.in=0A= index 43d32518ab34c048d51f2586ed1762c95d14ef68..a7607a3ddfaedd014c8890100ef= 76795888a10be 100644=0A= --- a/config.h.in=0A= +++ b/config.h.in=0A= @@ -292,4 +292,7 @@=0A= /* Define if -mmovbe is enabled by default on x86. */=0A= #undef HAVE_X86_MOVBE=0A= =0A= +/* Set to 1 if 64 bit atomics are supported. */=0A= +#define __HAVE_64B_ATOMICS 0=0A= +=0A= #endif=0A= diff --git a/configure b/configure=0A= index ff2c406b3b573484c843742d292fc2e0ee0e3008..fdbc9a6c2e6b84ff60e833eaf27= 19310444a5dac 100755=0A= --- a/configure=0A= +++ b/configure=0A= @@ -6316,6 +6316,43 @@ if test "$libc_cv_gcc_builtin_memset" =3D yes ; then= =0A= =0A= fi=0A= =0A= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit atomic suppor= t" >&5=0A= +$as_echo_n "checking for 64-bit atomic support... " >&6; }=0A= +if ${libc_cv_gcc_has_64b_atomics+:} false; then :=0A= + $as_echo_n "(cached) " >&6=0A= +else=0A= + cat > conftest.c <<\EOF=0A= +typedef struct { long long t; } X;=0A= +extern void has_64b_atomics(void);=0A= +void f(void)=0A= +{=0A= + X x;=0A= + /* Use address of structure with 64-bit type. This avoids incorrect=0A= + implementations which return true even if long long is not 64-bit ali= gned.=0A= + This works on GCC and LLVM - other cases have bugs and they disagree.= */=0A= + _Static_assert (__atomic_always_lock_free (sizeof (x), &x), "no_64b_atom= ics");=0A= +}=0A= +EOF=0A= +if { ac_try=3D'${CC-cc} -O2 -S conftest.c'=0A= + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5=0A= + (eval $ac_try) 2>&5=0A= + ac_status=3D$?=0A= + $as_echo "$as_me:${as_lineno-$LINENO}: \$? =3D $ac_status" >&5=0A= + test $ac_status =3D 0; }; };=0A= +then=0A= + libc_cv_gcc_has_64b_atomics=3Dyes=0A= +else=0A= + libc_cv_gcc_has_64b_atomics=3Dno=0A= +fi=0A= +rm -f conftest*=0A= +fi=0A= +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_has_64b_atom= ics" >&5=0A= +$as_echo "$libc_cv_gcc_has_64b_atomics" >&6; }=0A= +if test "$libc_cv_gcc_has_64b_atomics" =3D yes; then=0A= + $as_echo "#define __HAVE_64B_ATOMICS 1" >>confdefs.h=0A= +=0A= +fi=0A= +=0A= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for redirection of built= -in functions" >&5=0A= $as_echo_n "checking for redirection of built-in functions... " >&6; }=0A= if ${libc_cv_gcc_builtin_redirection+:} false; then :=0A= diff --git a/configure.ac b/configure.ac=0A= index eb5bc6a1313acb3f3614645739adeb7638f19617..ab1a248f50e7a4c0e36f8af6e2d= 6f7d8bf4c1787 100644=0A= --- a/configure.ac=0A= +++ b/configure.ac=0A= @@ -1443,6 +1443,31 @@ if test "$libc_cv_gcc_builtin_memset" =3D yes ; then= =0A= AC_DEFINE(HAVE_BUILTIN_MEMSET)=0A= fi=0A= =0A= +AC_CACHE_CHECK(for 64-bit atomic support, libc_cv_gcc_has_64b_atomics, [dn= l=0A= +cat > conftest.c <<\EOF=0A= +typedef struct { long long t; } X;=0A= +extern void has_64b_atomics(void);=0A= +void f(void)=0A= +{=0A= + X x;=0A= + /* Use address of structure with 64-bit type. This avoids incorrect=0A= + implementations which return true even if long long is not 64-bit ali= gned.=0A= + This works on GCC and LLVM - other cases have bugs and they disagree.= */=0A= + _Static_assert (__atomic_always_lock_free (sizeof (x), &x), "no_64b_atom= ics");=0A= +}=0A= +EOF=0A= +dnl=0A= +if AC_TRY_COMMAND([${CC-cc} -O2 -S conftest.c]);=0A= +then=0A= + libc_cv_gcc_has_64b_atomics=3Dyes=0A= +else=0A= + libc_cv_gcc_has_64b_atomics=3Dno=0A= +fi=0A= +rm -f conftest* ])=0A= +if test "$libc_cv_gcc_has_64b_atomics" =3D yes; then=0A= + AC_DEFINE(__HAVE_64B_ATOMICS, 1)=0A= +fi=0A= +=0A= AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_= redirection, [dnl=0A= cat > conftest.c <<\EOF=0A= extern char *strstr (const char *, const char *) __asm ("my_strstr");=0A= diff --git a/include/atomic.h b/include/atomic.h=0A= index e9ec063228b5aeeccb4c5d14d7c894f00617eefb..4494650f03d20299dcf0d6ee314= e93ed7fcf7043 100644=0A= --- a/include/atomic.h=0A= +++ b/include/atomic.h=0A= @@ -27,11 +27,6 @@=0A= - support functions like barriers. They also have the prefix=0A= "atomic_".=0A= =0A= - Architectures must provide a few lowlevel macros (the compare=0A= - and exchange definitions). All others are optional. They=0A= - should only be provided if the architecture has specific=0A= - support for the operation.=0A= -=0A= As macros are usually heavily nested and often use local=0A= variables to make sure side-effects are evaluated properly, use for=0A= macro local variables a per-macro unique prefix. This file uses=0A= @@ -74,43 +69,17 @@=0A= __atg11_oldval; })=0A= #endif=0A= =0A= -=0A= -/* This is equal to 1 iff the architecture supports 64b atomic operations.= */=0A= -#ifndef __HAVE_64B_ATOMICS=0A= -#error Unable to determine if 64-bit atomics are present.=0A= -#endif=0A= -=0A= /* The following functions are a subset of the atomic operations provided = by=0A= C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11= 's=0A= atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */= =0A= =0A= -=0A= -/* We require 32b atomic operations; some archs also support 64b atomic=0A= - operations. */=0A= -void __atomic_link_error (void);=0A= -# if __HAVE_64B_ATOMICS =3D=3D 1=0A= -# define __atomic_check_size(mem) \=0A= - if ((sizeof (*mem) !=3D 4) && (sizeof (*mem) !=3D 8)) \=0A= - __atomic_link_error ();=0A= -# else=0A= -# define __atomic_check_size(mem) \=0A= - if (sizeof (*mem) !=3D 4) \=0A= - __atomic_link_error ();=0A= -# endif=0A= -/* We additionally provide 8b and 16b atomic loads and stores; we do not y= et=0A= - need other atomic operations of such sizes, and restricting the support= to=0A= - loads and stores makes this easier for archs that do not have native=0A= - support for atomic operations to less-than-word-sized data. */=0A= -# if __HAVE_64B_ATOMICS =3D=3D 1=0A= -# define __atomic_check_size_ls(mem) \=0A= - if ((sizeof (*mem) !=3D 1) && (sizeof (*mem) !=3D 2) && (sizeof (*mem) = !=3D 4) \=0A= - && (sizeof (*mem) !=3D 8)) \=0A= - __atomic_link_error ();=0A= -# else=0A= -# define __atomic_check_size_ls(mem) \=0A= - if ((sizeof (*mem) !=3D 1) && (sizeof (*mem) !=3D 2) && sizeof (*mem) != =3D 4) \=0A= - __atomic_link_error ();=0A= -# endif=0A= +/* Check atomic operations are lock free. Since this doesn't work correct= ly=0A= + on all targets (eg. if uint64_t is 4-byte aligned), use__HAVE_64B_ATOMI= CS=0A= + for 64-bit types. */=0A= +#define __atomic_check_size(mem) \=0A= + _Static_assert (__atomic_always_lock_free (sizeof (*(mem)), 0) && = \=0A= + !(sizeof (*(mem)) =3D=3D 8 && __HAVE_64B_ATOMICS =3D=3D 0), \=0A= + "atomic not lock free!")=0A= =0A= # define atomic_thread_fence_acquire() \=0A= __atomic_thread_fence (__ATOMIC_ACQUIRE)=0A= @@ -120,20 +89,20 @@ void __atomic_link_error (void);=0A= __atomic_thread_fence (__ATOMIC_SEQ_CST)=0A= =0A= # define atomic_load_relaxed(mem) \=0A= - ({ __atomic_check_size_ls((mem)); \=0A= + ({ __atomic_check_size ((mem)); \=0A= __atomic_load_n ((mem), __ATOMIC_RELAXED); })=0A= # define atomic_load_acquire(mem) \=0A= - ({ __atomic_check_size_ls((mem)); \=0A= + ({ __atomic_check_size ((mem)); \=0A= __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })=0A= =0A= # define atomic_store_relaxed(mem, val) \=0A= do { \=0A= - __atomic_check_size_ls((mem)); \=0A= + __atomic_check_size ((mem)); \=0A= __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \=0A= } while (0)=0A= # define atomic_store_release(mem, val) \=0A= do { \=0A= - __atomic_check_size_ls((mem)); \=0A= + __atomic_check_size ((mem)); \=0A= __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \=0A= } while (0)=0A= =0A= @@ -218,12 +187,4 @@ void __atomic_link_error (void);=0A= # define atomic_spin_nop() do { /* nothing */ } while (0)=0A= #endif=0A= =0A= -/* ATOMIC_EXCHANGE_USES_CAS is non-zero if atomic_exchange operations=0A= - are implemented based on a CAS loop; otherwise, this is zero and we ass= ume=0A= - that the atomic_exchange operations could provide better performance=0A= - than a CAS loop. */=0A= -#ifndef ATOMIC_EXCHANGE_USES_CAS=0A= -# error ATOMIC_EXCHANGE_USES_CAS has to be defined.=0A= -#endif=0A= -=0A= #endif /* atomic.h */=0A= diff --git a/nptl/pthread_spin_lock.c b/nptl/pthread_spin_lock.c=0A= index 19d1759f9aa350d5a711ac8abe6f9db1464a1012..9122a260303a4356d7ee68274f0= 4b542090de380 100644=0A= --- a/nptl/pthread_spin_lock.c=0A= +++ b/nptl/pthread_spin_lock.c=0A= @@ -26,29 +26,12 @@ __pthread_spin_lock (pthread_spinlock_t *lock)=0A= int val =3D 0;=0A= =0A= /* We assume that the first try mostly will be successful, thus we use= =0A= - atomic_exchange if it is not implemented by a CAS loop (we also assum= e=0A= - that atomic_exchange can be faster if it succeeds, see=0A= - ATOMIC_EXCHANGE_USES_CAS). Otherwise, we use a weak CAS and not an= =0A= - exchange so we bail out after the first failed attempt to change the= =0A= - state. For the subsequent attempts we use atomic_compare_and_exchang= e=0A= - after we observe that the lock is not acquired.=0A= - See also comment in pthread_spin_trylock.=0A= + atomic_exchange.=0A= We use acquire MO to synchronize-with the release MO store in=0A= pthread_spin_unlock, and thus ensure that prior critical sections=0A= happen-before this critical section. */=0A= -#if ! ATOMIC_EXCHANGE_USES_CAS=0A= - /* Try to acquire the lock with an exchange instruction as this architec= ture=0A= - has such an instruction and we assume it is faster than a CAS.=0A= - The acquisition succeeds if the lock is not in an acquired state. */= =0A= if (__glibc_likely (atomic_exchange_acquire (lock, 1) =3D=3D 0))=0A= return 0;=0A= -#else=0A= - /* Try to acquire the lock with a CAS instruction as this architecture= =0A= - has no exchange instruction. The acquisition succeeds if the lock is= not=0A= - acquired. */=0A= - if (__glibc_likely (atomic_compare_exchange_weak_acquire (lock, &val, 1)= ))=0A= - return 0;=0A= -#endif=0A= =0A= do=0A= {=0A= diff --git a/nptl/pthread_spin_trylock.c b/nptl/pthread_spin_trylock.c=0A= index f2b12f9b4fe34340c9a2e449f2652908a7ff469d..3bd870401cdb336fe05469c3944= b82fa563869be 100644=0A= --- a/nptl/pthread_spin_trylock.c=0A= +++ b/nptl/pthread_spin_trylock.c=0A= @@ -24,57 +24,8 @@=0A= int=0A= __pthread_spin_trylock (pthread_spinlock_t *lock)=0A= {=0A= - /* For the spin try lock, we have the following possibilities:=0A= -=0A= - 1) If we assume that trylock will most likely succeed in practice:=0A= - * We just do an exchange.=0A= -=0A= - 2) If we want to bias towards cases where trylock succeeds, but don't= =0A= - rule out contention:=0A= - * If exchange is not implemented by a CAS loop, and exchange is faste= r=0A= - than CAS, do an exchange.=0A= - * If exchange is implemented by a CAS loop, use a weak CAS and not an= =0A= - exchange so we bail out after the first failed attempt to change the = state.=0A= -=0A= - 3) If we expect contention to be likely:=0A= - * If CAS always brings the cache line into an exclusive state even if= the=0A= - spinlock is already acquired, then load the value first with=0A= - atomic_load_relaxed and test if lock is not acquired. Then do 2).=0A= -=0A= - We assume that 2) is the common case, and that this won't be slower t= han=0A= - 1) in the common case.=0A= -=0A= - We use acquire MO to synchronize-with the release MO store in=0A= - pthread_spin_unlock, and thus ensure that prior critical sections=0A= - happen-before this critical section. */=0A= -#if ! ATOMIC_EXCHANGE_USES_CAS=0A= - /* Try to acquire the lock with an exchange instruction as this architec= ture=0A= - has such an instruction and we assume it is faster than a CAS.=0A= - The acquisition succeeds if the lock is not in an acquired state. */= =0A= if (atomic_exchange_acquire (lock, 1) =3D=3D 0)=0A= return 0;=0A= -#else=0A= - /* Try to acquire the lock with a CAS instruction as this architecture= =0A= - has no exchange instruction. The acquisition succeeds if the lock is= not=0A= - acquired. */=0A= - do=0A= - {=0A= - int val =3D 0;=0A= - if (atomic_compare_exchange_weak_acquire (lock, &val, 1))=0A= - return 0;=0A= - }=0A= - /* atomic_compare_exchange_weak_acquire can fail spuriously. Whereas=0A= - C++11 and C11 make it clear that trylock operations can fail spurious= ly,=0A= - POSIX does not explicitly specify this; it only specifies that failin= g=0A= - synchronization operations do not need to have synchronization effect= s=0A= - themselves, but a spurious failure is something that could contradict= a=0A= - happens-before established earlier (e.g., that we need to observe tha= t=0A= - the lock is acquired). Therefore, we emulate a strong CAS by simply= =0A= - checking with a relaxed MO load that the lock is really acquired befo= re=0A= - returning EBUSY; the additional overhead this may cause is on the slo= w=0A= - path. */=0A= - while (atomic_load_relaxed (lock) =3D=3D 0);=0A= -#endif=0A= =0A= return EBUSY;=0A= }=0A= diff --git a/sysdeps/aarch64/atomic-machine.h b/sysdeps/aarch64/atomic-mach= ine.h=0A= deleted file mode 100644=0A= index 2dc1c524e40e2e805161e6d9b1b385b85c53a5c8..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/aarch64/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,25 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= -=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _AARCH64_ATOMIC_MACHINE_H=0A= -#define _AARCH64_ATOMIC_MACHINE_H 1=0A= -=0A= -#define __HAVE_64B_ATOMICS 1=0A= -#define ATOMIC_EXCHANGE_USES_CAS 0=0A= -=0A= -#endif=0A= diff --git a/sysdeps/alpha/atomic-machine.h b/sysdeps/alpha/atomic-machine.= h=0A= deleted file mode 100644=0A= index 7fbe5b87eebf323d38fe1349b02aa56fe199cab3..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/alpha/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,23 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#include =0A= -=0A= -#define __HAVE_64B_ATOMICS 1=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/arc/atomic-machine.h b/sysdeps/arc/atomic-machine.h=0A= deleted file mode 100644=0A= index 2d519e3bbfa9ce77f4a41e313b67a690569d032e..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/arc/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,28 +0,0 @@=0A= -/* Low-level functions for atomic operations. ARC version.=0A= - Copyright (C) 2020-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _ARC_BITS_ATOMIC_H=0A= -#define _ARC_BITS_ATOMIC_H 1=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* ARC does have legacy atomic EX reg, [mem] instruction but the micro-arc= h=0A= - is not as optimal as LLOCK/SCOND specially for SMP. */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif /* _ARC_BITS_ATOMIC_H */=0A= diff --git a/sysdeps/arm/atomic-machine.h b/sysdeps/arm/atomic-machine.h=0A= deleted file mode 100644=0A= index b172573ae74dc9d6c7618bfdb76f5fb0429469f8..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/arm/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,20 +0,0 @@=0A= -/* Atomic operations. Pure ARM version.=0A= - Copyright (C) 2002-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/csky/atomic-machine.h b/sysdeps/csky/atomic-machine.h= =0A= deleted file mode 100644=0A= index 4a7dc63be2044990852c52500943c90c898363be..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/csky/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,25 +0,0 @@=0A= -/* Atomic operations. C-SKY version.=0A= - Copyright (C) 2018-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef __CSKY_ATOMIC_H_=0A= -#define __CSKY_ATOMIC_H_=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif /* atomic-machine.h */=0A= diff --git a/sysdeps/ia64/atomic-machine.h b/sysdeps/ia64/atomic-machine.h= =0A= deleted file mode 100644=0A= index 6f31c7b2eea67b5d8766dea1c38df6eedc168ebf..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/ia64/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,23 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library; if not, see=0A= - . */=0A= -=0A= -#include =0A= -=0A= -#define __HAVE_64B_ATOMICS 1=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 0=0A= diff --git a/sysdeps/m68k/coldfire/atomic-machine.h b/sysdeps/m68k/coldfire= /atomic-machine.h=0A= deleted file mode 100644=0A= index 1503703ed36b825f6e9f2cb2ed1516cd80bd9947..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/m68k/coldfire/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,27 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _ATOMIC_MACHINE_H=0A= -#define _ATOMIC_MACHINE_H 1=0A= -=0A= -/* If we have just non-atomic operations, we can as well make them wide. = */=0A= -#define __HAVE_64B_ATOMICS 1=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif=0A= diff --git a/sysdeps/m68k/m680x0/m68020/atomic-machine.h b/sysdeps/m68k/m68= 0x0/m68020/atomic-machine.h=0A= deleted file mode 100644=0A= index d356b55c9f9082db8dde734c254e01a631201206..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/m68k/m680x0/m68020/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,22 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -/* GCC does not support lock-free 64-bit atomic_load/store. */=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/microblaze/atomic-machine.h b/sysdeps/microblaze/atomi= c-machine.h=0A= deleted file mode 100644=0A= index 4e7ccce21e59453f5233bdf82b22215d9a6d17b3..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/microblaze/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,24 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= -=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#include =0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/mips/atomic-machine.h b/sysdeps/mips/atomic-machine.h= =0A= deleted file mode 100644=0A= index 1e611c2153996d28e14611c60189f52d0919b79c..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/mips/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,38 +0,0 @@=0A= -/* Low-level functions for atomic operations. Mips version.=0A= - Copyright (C) 2005-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _MIPS_ATOMIC_MACHINE_H=0A= -#define _MIPS_ATOMIC_MACHINE_H 1=0A= -=0A= -#include =0A= -=0A= -#if _MIPS_SIM =3D=3D _ABIO32 || _MIPS_SIM =3D=3D _ABIN32=0A= -#define __HAVE_64B_ATOMICS 0=0A= -#else=0A= -#define __HAVE_64B_ATOMICS 1=0A= -#endif=0A= -=0A= -/* MIPS is an LL/SC machine. However, XLP has a direct atomic exchange=0A= - instruction which will be used by __atomic_exchange_n. */=0A= -#ifdef _MIPS_ARCH_XLP=0A= -# define ATOMIC_EXCHANGE_USES_CAS 0=0A= -#else=0A= -# define ATOMIC_EXCHANGE_USES_CAS 1=0A= -#endif=0A= -=0A= -#endif /* atomic-machine.h */=0A= diff --git a/sysdeps/or1k/atomic-machine.h b/sysdeps/or1k/atomic-machine.h= =0A= deleted file mode 100644=0A= index 90a10867b3f9cf97a0f2f521f6759a0008ef5b82..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/or1k/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,27 +0,0 @@=0A= -/* Atomic operations. OpenRISC version.=0A= - Copyright (C) 2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef __OR1K_ATOMIC_H_=0A= -#define __OR1K_ATOMIC_H_=0A= -=0A= -#include =0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif /* atomic-machine.h */=0A= diff --git a/sysdeps/powerpc/powerpc32/atomic-machine.h b/sysdeps/powerpc/p= owerpc32/atomic-machine.h=0A= index 6a2aae8bdb34281144e6810924377a6a62857d15..5d1d1ca120530371daaf97d5d0c= 5b545b2327a78 100644=0A= --- a/sysdeps/powerpc/powerpc32/atomic-machine.h=0A= +++ b/sysdeps/powerpc/powerpc32/atomic-machine.h=0A= @@ -33,6 +33,3 @@=0A= #endif=0A= =0A= #define __ARCH_ACQ_INSTR "isync"=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/powerpc/powerpc64/atomic-machine.h b/sysdeps/powerpc/p= owerpc64/atomic-machine.h=0A= index 2932f889c5bc6d0fa49d5ad36875b50c27ad07e9..cdee4b84827bcb8455972302725= edb3fb76a744c 100644=0A= --- a/sysdeps/powerpc/powerpc64/atomic-machine.h=0A= +++ b/sysdeps/powerpc/powerpc64/atomic-machine.h=0A= @@ -33,6 +33,3 @@=0A= #endif=0A= =0A= #define __ARCH_ACQ_INSTR "isync"=0A= -=0A= -#define __HAVE_64B_ATOMICS 1=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/s390/atomic-machine.h b/sysdeps/s390/atomic-machine.h= =0A= deleted file mode 100644=0A= index 3e25dcf44126001382e3b98aa2f82d29e29f1424..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/s390/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,24 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library; if not, see=0A= - . */=0A= -=0A= -#ifdef __s390x__=0A= -# define __HAVE_64B_ATOMICS 1=0A= -#else=0A= -# define __HAVE_64B_ATOMICS 0=0A= -#endif=0A= -=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/sparc/atomic-machine.h b/sysdeps/sparc/atomic-machine.= h=0A= index 1f0eb0a9b1171c06dc19dc21c4fe7de94adc4bce..7ea88d598b9a36735004fe03cb5= 2e46fe4807140 100644=0A= --- a/sysdeps/sparc/atomic-machine.h=0A= +++ b/sysdeps/sparc/atomic-machine.h=0A= @@ -19,15 +19,6 @@=0A= #ifndef _ATOMIC_MACHINE_H=0A= #define _ATOMIC_MACHINE_H 1=0A= =0A= -#ifdef __arch64__=0A= -# define __HAVE_64B_ATOMICS 1=0A= -#else=0A= -# define __HAVE_64B_ATOMICS 0=0A= -#endif=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS __HAVE_64B_ATOMICS=0A= -=0A= #ifdef __sparc_v9__=0A= =0A= extern void __cpu_relax (void);=0A= diff --git a/sysdeps/unix/sysv/linux/hppa/atomic-machine.h b/sysdeps/unix/s= ysv/linux/hppa/atomic-machine.h=0A= deleted file mode 100644=0A= index 9c9fecbefef037e3b7e8c291e722d093b811dd69..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/unix/sysv/linux/hppa/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,27 +0,0 @@=0A= -/* Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _ATOMIC_MACHINE_H=0A= -#define _ATOMIC_MACHINE_H 1=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif=0A= -/* _ATOMIC_MACHINE_H */=0A= diff --git a/sysdeps/unix/sysv/linux/loongarch/atomic-machine.h b/sysdeps/u= nix/sysv/linux/loongarch/atomic-machine.h=0A= deleted file mode 100644=0A= index c94144605fcd16c1dd3e35a86eb325e1acb4d282..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/unix/sysv/linux/loongarch/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,27 +0,0 @@=0A= -/* Atomic operations.=0A= - Copyright (C) 2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _LINUX_LOONGARCH_BITS_ATOMIC_H=0A= -#define _LINUX_LOONGARCH_BITS_ATOMIC_H 1=0A= -=0A= -#define atomic_full_barrier() __sync_synchronize ()=0A= -=0A= -#define __HAVE_64B_ATOMICS (__loongarch_grlen >=3D 64)=0A= -#define ATOMIC_EXCHANGE_USES_CAS 0=0A= -=0A= -#endif /* bits/atomic.h */=0A= diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h b/sysde= ps/unix/sysv/linux/m68k/coldfire/atomic-machine.h=0A= deleted file mode 100644=0A= index 02e54847a42bfbc93ae1e07b7e32965be644daba..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,28 +0,0 @@=0A= -/* Copyright (C) 2010-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _ATOMIC_MACHINE_H=0A= -#define _ATOMIC_MACHINE_H 1=0A= -=0A= -#include =0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif=0A= diff --git a/sysdeps/unix/sysv/linux/nios2/atomic-machine.h b/sysdeps/unix/= sysv/linux/nios2/atomic-machine.h=0A= deleted file mode 100644=0A= index 4b4b714f93f4c4b9f7f650d70d2301299a45e2f5..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/unix/sysv/linux/nios2/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,27 +0,0 @@=0A= -/* Low-level functions for atomic operations. Nios II version.=0A= - Copyright (C) 2012-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library. If not, see=0A= - . */=0A= -=0A= -#ifndef _NIOS2_ATOMIC_MACHINE_H=0A= -#define _NIOS2_ATOMIC_MACHINE_H 1=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= -=0A= -#endif /* _NIOS2_ATOMIC_MACHINE_H */=0A= diff --git a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h b/sysdeps/unix/= sysv/linux/riscv/atomic-machine.h=0A= index b0ebe09ce1fa4e15064dd57d83cadb8a1976f86d..90c48b301e8dad46017fe8d6497= 756cdd74268c8 100644=0A= --- a/sysdeps/unix/sysv/linux/riscv/atomic-machine.h=0A= +++ b/sysdeps/unix/sysv/linux/riscv/atomic-machine.h=0A= @@ -21,9 +21,6 @@=0A= =0A= #ifdef __riscv_atomic=0A= =0A= -# define __HAVE_64B_ATOMICS (__riscv_xlen >=3D 64)=0A= -# define ATOMIC_EXCHANGE_USES_CAS 0=0A= -=0A= /* Miscellaneous. */=0A= =0A= # define asm_amo(which, ordering, mem, value) ({ \=0A= diff --git a/sysdeps/unix/sysv/linux/sh/atomic-machine.h b/sysdeps/unix/sys= v/linux/sh/atomic-machine.h=0A= deleted file mode 100644=0A= index 71848194daa98ad0391c029a8c7d9dba5ba5fe3d..000000000000000000000000000= 0000000000000=0A= --- a/sysdeps/unix/sysv/linux/sh/atomic-machine.h=0A= +++ /dev/null=0A= @@ -1,22 +0,0 @@=0A= -/* Atomic operations used inside libc. Linux/SH version.=0A= - Copyright (C) 2003-2022 Free Software Foundation, Inc.=0A= - This file is part of the GNU C Library.=0A= -=0A= - The GNU C Library is free software; you can redistribute it and/or=0A= - modify it under the terms of the GNU Lesser General Public=0A= - License as published by the Free Software Foundation; either=0A= - version 2.1 of the License, or (at your option) any later version.=0A= -=0A= - The GNU C Library is distributed in the hope that it will be useful,=0A= - but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU=0A= - Lesser General Public License for more details.=0A= -=0A= - You should have received a copy of the GNU Lesser General Public=0A= - License along with the GNU C Library; if not, see=0A= - . */=0A= -=0A= -#define __HAVE_64B_ATOMICS 0=0A= -=0A= -/* XXX Is this actually correct? */=0A= -#define ATOMIC_EXCHANGE_USES_CAS 1=0A= diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/= sysv/linux/sparc/sparc32/Makefile=0A= index 21c7dc1680caf19cb21a36ade3cb4baaee188159..1b8b1c516ac1e70b36650e00f06= c8d2425a4d882 100644=0A= --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile=0A= +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile=0A= @@ -11,7 +11,7 @@ endif=0A= =0A= # When I get this to work, this is the right thing=0A= ifeq ($(subdir),elf)=0A= -CFLAGS-rtld.c +=3D -mcpu=3Dv8=0A= +#CFLAGS-rtld.c +=3D -mcpu=3Dv8 # causes leon3 builds to fail=0A= #rtld-routines +=3D dl-sysdepsparc=0A= sysdep-others +=3D lddlibc4=0A= install-bin +=3D lddlibc4=0A= diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h=0A= index 98541a2d06ff5e4aa8c789ab7405215097471971..303458d1296e4b1cd7cd654e090= 4ace0ffc52fae 100644=0A= --- a/sysdeps/x86/atomic-machine.h=0A= +++ b/sysdeps/x86/atomic-machine.h=0A= @@ -21,17 +21,6 @@=0A= =0A= #include /* For mach. */=0A= =0A= -#ifdef __x86_64__=0A= -# define __HAVE_64B_ATOMICS 1=0A= -#else=0A= -/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the=0A= - i386 psABI supplement provides only 4-byte alignment for uint64_t=0A= - inside structs, so it is currently not possible to use 64-bit=0A= - atomics on this platform. */=0A= -# define __HAVE_64B_ATOMICS 0=0A= -#endif=0A= -#define ATOMIC_EXCHANGE_USES_CAS 0=0A= -=0A= #define atomic_spin_nop() __asm ("pause")=0A= =0A= #endif /* atomic-machine.h */=0A=