From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2084.outbound.protection.outlook.com [40.107.21.84]) by sourceware.org (Postfix) with ESMTPS id B09413858D3C for ; Wed, 8 Dec 2021 11:05:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B09413858D3C Received: from DB6P195CA0002.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::12) by AS8PR08MB5880.eurprd08.prod.outlook.com (2603:10a6:20b:29f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Wed, 8 Dec 2021 11:05:18 +0000 Received: from DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:cb:cafe::7b) by DB6P195CA0002.outlook.office365.com (2603:10a6:4:cb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16 via Frontend Transport; Wed, 8 Dec 2021 11:05:18 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT059.mail.protection.outlook.com (10.152.21.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.13 via Frontend Transport; Wed, 8 Dec 2021 11:05:18 +0000 Received: ("Tessian outbound f493ab4f1fb8:v110"); Wed, 08 Dec 2021 11:05:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 003a171a23840a60 X-CR-MTA-TID: 64aa7808 Received: from fb1e721fa71b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0AAACF69-F4D5-4FC4-9449-57B5916D7139.1; Wed, 08 Dec 2021 11:05:05 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fb1e721fa71b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Dec 2021 11:05:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HbAuVtku43TW+miTHyGhcXD9+LhYsWA10c1Jg6bT9uVcMwoKYbIYCP36K6uWIdf/BbZeb8kfDJZYK0unLNDKAuXLnVf8eEnU3dnVxxrEv+PWfvwkdCqlikolqZrl9eHb0agQYuR7dU9B0kwE6m6bG2AWl7LPVSbWZWnrefHQdfPGpasp95mfaq11mAI431ijXCitDUyVDLyjsn1eTVkITYt2RUNm+9FoZfAOTHHLoYw+AiuwTsVX0eAVW3Kb+RoV9zfYRMqqMs1gkMxcRczVCAcCUKPtoqKOG2AFlE8+WVRtQisgpSBrRxXna4FuQCNajQDBkC6SW8CHfsXUxN3GFA== 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=5WS302Z48P+vO0tnbDs0aNXGwxg91mNs/tvBoQED2fk=; b=ZLXEFtsjcNk3JpNnkZVBRPSiHnMU1FhVerLHkxZzSTLAwmmhpCZG5HIyfNl2MpUoN8gtEX2TlKuU1xHiUkZCloojdjT/mPJyWmfxs6AU638WjjxXssPdKLqme6VatDbLjLTwl9fnVlnbnQr5HZfnmEGHqzUnaz/0qhQlBcVHFZ7uHfUzC7G1bySUA7d4VQIrUuzJa1EXTOn53mBMcx02iOZa3Bsd2/fzC9BH4Cf+fRSG3m6VlEfRpoD3IbCTPAf3n79P2rEtsMheAjcWIO64QkpHttmQrfl8txkqPvhYISkYkJvVFeX1t+nHrCX3CrkVMWUwz5tdzNMzZEQ08IR7KQ== 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 Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by DB9PR08MB7161.eurprd08.prod.outlook.com (2603:10a6:10:2ca::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Wed, 8 Dec 2021 11:05:04 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::25f9:a7e6:422a:da43]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::25f9:a7e6:422a:da43%6]) with mapi id 15.20.4755.022; Wed, 8 Dec 2021 11:05:03 +0000 Date: Wed, 8 Dec 2021 11:05:02 +0000 From: Szabolcs Nagy To: Florian Weimer Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 1/8] nptl: Add for defining __thread_pointer Message-ID: <20211208110502.GE3294453@arm.com> References: <48b399368593be9675a23e7e2dc53f64c46a94d2.1638880889.git.fweimer@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <48b399368593be9675a23e7e2dc53f64c46a94d2.1638880889.git.fweimer@redhat.com> X-ClientProxiedBy: LO4P123CA0146.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::7) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 Received: from arm.com (217.140.106.51) by LO4P123CA0146.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Wed, 8 Dec 2021 11:05:03 +0000 X-MS-Office365-Filtering-Correlation-Id: b17e5f48-2dbf-4f7e-4f63-08d9ba3a9ec9 X-MS-TrafficTypeDiagnostic: DB9PR08MB7161:EE_|DB5EUR03FT059:EE_|AS8PR08MB5880:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: EkaoftviYvQss42CCQHeRCJU9jNCzcTBxGdS0c+dTcYeul4UQWxPfjuOi51lA8jn8mWyhxFB0bA/qotRyZqHHJi/KqzNGQav68kEZmMR7+0FB6G7XesAaI+jDqeBQTpPZqkjshsf9dpimOQu0r4GazrOcVCUNSSrYakDLeeJ7uKKFWAGAIvu6Dnu+dV8LZ4XBpMaKcyYhkFEjkyBG9EBhO6RBjxuFrIhOoCuGImwCHLX8HDTFZqE3wHPKwj7jTFFfJ7PQF4GcWBONrp2NZ0ejA5pM1/XNVcNrHiTRWf5reLoBTPTJwlGOrbI0hQrql8Uo7vTpmkadfqzeEV1zhwes/GxqrxnzOZucdeV02QhDQxyIgKg+4Z3wM17xbb9GcKy43GlofBGuNmn1Nh16fr/amQLsuezREPCOLaUz8t2zlu0hSOY6hYqkXPiKlhkpcfm7uP4rbdyxwEPxcxiCgHF2NF8Wt0MKtC/n9e2y3n7CPlMmYgRr+LCCZ/4elUYYkQjNAtypekwqbkGbxaADfkRa21jCvDmqdB9frIkh5+oY4mLqs8Gig/JOLhFt8AYNJ+1ZshZzO+mB8TYwpvZblOfcE1ty1Cr/YJALegDCfUraJUwYoHPl8pbyIUi3+70/5xaKFVyT1heySPeUZym8WWkOKxpvIEiwsHXJQ+YdklHUlia/ElNV3Ontw14wJ1nsh5RyKa5UGWkbLmGOKAmBHRbYWSFJpIpJdGq+ptfQpZXRH0jUuqw0QFFgPvOit/nPu1I7LDduM5V5WE0Ng5suWtrhaZLGuuRAKTcXKHHs+KIUZjMoVf8PaIqKcos4BAegYOH X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB7179.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66946007)(66476007)(5660300002)(44832011)(2616005)(7696005)(66556008)(186003)(4326008)(8936002)(8676002)(38350700002)(38100700002)(6916009)(26005)(956004)(36756003)(508600001)(55016003)(52116002)(86362001)(33656002)(2906002)(316002)(8886007)(1076003)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7161 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: DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 84f9c71b-dc9a-4c80-e4b8-08d9ba3a95ee X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d9+AVQp/o1dzu6UIDgVlppWXu+tSXsIW6qHthgSKAeENId6je45kwMk7VQwD7ssDrNkGsONFYH9xwvSGeLuIA0WLij05gFyneDyoxALQ9ZzOTc/0wUWZFrbHn0t1Lf1ubHpFFsC9jGml0Xs7Sx7EnuXRGFJ2L0hR/TT/q2MWOYgKG8qu1h1YOnkHZOuyRr9l2CX3gf0iPwQV//ILwRxGHpsvy7iL7SGPHZWNZPxEB1NWqIOnWNi4YhcZ7D1wbSjxKqKyqdWYQ38fIm60S0z+2B6/GP5sDTXWQFuwmujSjDuMpsVxjQXyObc85vN0IRqvctVatVJlWgY4F55wSvbzzdy1BV6jNziatzU0spXcRt4s+ko9WZf0K9Sjo7Ly7zNmr2YKP1i7+KYHglk8VlUSWUSIR0VaEbvNyYZoT6gwFlMjlQO8GWEMh7bHIEXKHjgweR9z0kU1oy3fevssJzHKK0Wgj+6a5DzT0OoO8zOIVEDCevrjzMg+Q7YMUWJ8xsVDDQd8YITddotOvOeu1lMRFhEYCEDH+HEVwPtfeHQpWETWpfB/x8BciPYG50pO4cuTamVf8Ung6j7WkWu9lckX8oVG0OzBbYItxwP33lv9XqjD93gNa7/Ibujy86KpIYcjtqINwf7JxP3etWWIsKp+23+6TeAjnzDfznYSBNivvvKYalHlIQhIG4CsahttLWXt/jlJL7lx1kIAFocJJUZpQKCOY95CKeDWg7yF4DWBU+kB4v7EKtDjOJOdVLzHqvD8UKVfKGmm1SEVcmLLhARPMObq7TfhXJtdZD82qP9kTwMUG88v0YV48On3uh2YIgIn 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:(4636009)(36840700001)(46966006)(4326008)(33656002)(47076005)(55016003)(82310400004)(36756003)(7696005)(81166007)(36860700001)(356005)(1076003)(86362001)(5660300002)(6862004)(316002)(508600001)(26005)(2906002)(186003)(70206006)(44832011)(70586007)(336012)(8936002)(2616005)(8676002)(956004)(8886007)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2021 11:05:18.4342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b17e5f48-2dbf-4f7e-4f63-08d9ba3a9ec9 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: DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5880 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, TXREP, T_SPF_HELO_TEMPERROR, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 08 Dec 2021 11:05:29 -0000 The 12/07/2021 14:00, Florian Weimer via Libc-alpha wrote: > already contains a definition that is quite similar, > but it is not consistent across architectures. > > Only architectures for which rseq support is added are covered. This looks ok. It's an annoying gcc bug that __builtin_thread_pointer does not work consistently across targets. Reviewed-by: Szabolcs Nagy > --- > v2: As posted before. > > sysdeps/nptl/thread_pointer.h | 28 ++++++++++++++++++++ > sysdeps/powerpc/nptl/thread_pointer.h | 33 +++++++++++++++++++++++ > sysdeps/x86/nptl/thread_pointer.h | 38 +++++++++++++++++++++++++++ > 3 files changed, 99 insertions(+) > create mode 100644 sysdeps/nptl/thread_pointer.h > create mode 100644 sysdeps/powerpc/nptl/thread_pointer.h > create mode 100644 sysdeps/x86/nptl/thread_pointer.h > > diff --git a/sysdeps/nptl/thread_pointer.h b/sysdeps/nptl/thread_pointer.h > new file mode 100644 > index 0000000000..92f2f3093e > --- /dev/null > +++ b/sysdeps/nptl/thread_pointer.h > @@ -0,0 +1,28 @@ > +/* __thread_pointer definition. Generic version. > + Copyright (C) 2021 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 > + . */ > + > +#ifndef _SYS_THREAD_POINTER_H > +#define _SYS_THREAD_POINTER_H > + > +static inline void * > +__thread_pointer (void) > +{ > + return __builtin_thread_pointer (); > +} > + > +#endif /* _SYS_THREAD_POINTER_H */ > diff --git a/sysdeps/powerpc/nptl/thread_pointer.h b/sysdeps/powerpc/nptl/thread_pointer.h > new file mode 100644 > index 0000000000..8fd5ba671f > --- /dev/null > +++ b/sysdeps/powerpc/nptl/thread_pointer.h > @@ -0,0 +1,33 @@ > +/* __thread_pointer definition. powerpc version. > + Copyright (C) 2021 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 > + . */ > + > +#ifndef _SYS_THREAD_POINTER_H > +#define _SYS_THREAD_POINTER_H > + > +static inline void * > +__thread_pointer (void) > +{ > +#ifdef __powerpc64__ > + register void *__result asm ("r13"); > +#else > + register void *__result asm ("r2"); > +#endif > + return __result; > +} > + > +#endif /* _SYS_THREAD_POINTER_H */ > diff --git a/sysdeps/x86/nptl/thread_pointer.h b/sysdeps/x86/nptl/thread_pointer.h > new file mode 100644 > index 0000000000..6b71b6f7e1 > --- /dev/null > +++ b/sysdeps/x86/nptl/thread_pointer.h > @@ -0,0 +1,38 @@ > +/* __thread_pointer definition. x86 version. > + Copyright (C) 2021 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 > + . */ > + > +#ifndef _SYS_THREAD_POINTER_H > +#define _SYS_THREAD_POINTER_H > + > +static inline void * > +__thread_pointer (void) > +{ > +#if __GNUC_PREREQ (11, 1) > + return __builtin_thread_pointer (); > +#else > + void *__result; > +# ifdef __x86_64__ > + __asm__ ("mov %%fs:0, %0" : "=r" (__result)); > +# else > + __asm__ ("mov %%gs:0, %0" : "=r" (__result)); > +# endif > + return __result; > +#endif /* !GCC 11 */ > +} > + > +#endif /* _SYS_THREAD_POINTER_H */ > -- > 2.33.1 > >