From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130059.outbound.protection.outlook.com [40.107.13.59]) by sourceware.org (Postfix) with ESMTPS id 534683858C39 for ; Thu, 9 Dec 2021 11:52:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 534683858C39 Received: from AM5PR0602CA0009.eurprd06.prod.outlook.com (2603:10a6:203:a3::19) by AM5PR0802MB2418.eurprd08.prod.outlook.com (2603:10a6:203:9f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Thu, 9 Dec 2021 11:52:35 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:a3:cafe::3) by AM5PR0602CA0009.outlook.office365.com (2603:10a6:203:a3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11 via Frontend Transport; Thu, 9 Dec 2021 11:52:35 +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 AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.13 via Frontend Transport; Thu, 9 Dec 2021 11:52:35 +0000 Received: ("Tessian outbound de6049708a0a:v110"); Thu, 09 Dec 2021 11:52:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dd6ac0fe19894498 X-CR-MTA-TID: 64aa7808 Received: from c8df68fc1e34.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 70DD249A-EB75-4D9C-9CEF-B9487066B89C.1; Thu, 09 Dec 2021 11:52:27 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c8df68fc1e34.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 09 Dec 2021 11:52:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ABUmtprMMjxHUsq/hhw5zgdgWlmbG/ChqAFQfIReKHCY44Br+cZKit205vIhHPcg1sA8k3EvZh8ICv9WZoRQ+vhKeDEkhzN6NhUtVssdlyRGi1hTlQWh9TuUVrH7IPqZY90f3oHaPmrneWA0cGkvV98/udD2EXbeVU3PJwMfyhuZ9vvTJwTvt0vriwyxxkKqOt6NNqqJnDwRE9OeZiIrggNKC/u+uI0Bp4NWgZH9tGbioQvfTd6fOHMUXNXCA2dGHxaOwLk6nCUjBh8JIvvifL0ObkS1auDuyd3XfvtPyx3mlRo9CKT/HxoJhIOi/3NU840HqHZMW2HcGlm4lD4b5A== 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=AfBuAu6XSIRQM3kWxhpUbcOLdkY7WyfDzVJ1VS8o+xw=; b=RFLDZc9Nt2sep5eNoHZDZ+r8Era+8bFYhYANjTsvCHnuvLwm+eKS16/OhcupSMxq8wAFgIolQmgwN02hHdz/7J9yN5yUslK6VDGeL2KiKA5slcxpXPvKA3bqtRXgqH6PmgsGu4Xs0WkLfH6h1uIW6Qe5Y18sByYUlv4PCtq+mGVAAkhcyzZ0JrGKY9700YgJ0gLLRu4Bxj6IIpjo6tt7JxDlkruDNDy8EbZMKgPmueyJIQkE+KUUgBp9gVOTd9RBjorKvxDmpyqCYqxRTsq20VD+YTiLTC95mqpj3x7/nnWkQbTCpp1IAaJPsl7qfkL1uDUwIHX5V12VEVCTq2xrzw== 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 DB9PR08MB7084.eurprd08.prod.outlook.com (2603:10a6:10:2c4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Thu, 9 Dec 2021 11:52:25 +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; Thu, 9 Dec 2021 11:52:25 +0000 Date: Thu, 9 Dec 2021 11:52:23 +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: <20211209115223.GN3294453@arm.com> References: <48b399368593be9675a23e7e2dc53f64c46a94d2.1638880889.git.fweimer@redhat.com> <20211208110502.GE3294453@arm.com> <87pmq7j80g.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87pmq7j80g.fsf@oldenburg.str.redhat.com> X-ClientProxiedBy: LO4P123CA0139.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::18) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 Received: from arm.com (217.140.106.49) by LO4P123CA0139.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.17 via Frontend Transport; Thu, 9 Dec 2021 11:52:25 +0000 X-MS-Office365-Filtering-Correlation-Id: 3001715a-07a6-49cf-8808-08d9bb0a6403 X-MS-TrafficTypeDiagnostic: DB9PR08MB7084:EE_|AM5EUR03FT013:EE_|AM5PR0802MB2418:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: sEN1D7LqAN717eMTSYkK2863nuArZTnTvnqFliy9dYXCnHzBdFX4ONgaHLd4XqRJXoWYRJ2Ob0vG1fUyKWKvSkWFCQy8El+EnCiTVIKKZBm7bG2g74Ta9Ysx06WPPJKR1itef2CH6MDUFVLWY+nv4aOR9tKiQMt//DsEcZD6Aln3eTcC2Jt6PBBeZLfKOV+pnbMVWymFc8GZIr30wqYCHwdbKswNtKKFTiBC/0wBg/w79ZkP2JWQV/2tyGu1krMeo0KQ/qsAjli3QnXzzKryjZxiD+QF1Jg0Jg2BxQFiaadyZkcXUrlIQh7HWuj2LexoskfLqyCp/5YyuksyqGZTH7zk9rQmo9AgWKJkT5/CCw2tLYJSXfkOSJ8l9V9vA1YZbLjMstRpLzBTb3PrnX8XquxGI23l6zAAmVjWDHWcwdybA+zaydrWCNikRDxe48o93HS5E99WlRWy8gqaJ8yS6n3JXF7twKSMTy4kDaopVocr1udWeYZ8KibnUOl/fZtt2Xtir2MD3YnitB2e3SLLYDcUXgPUokxIkpKQEOVIXTdfZuVyFJerKWc+VKrSBpnWsTaXsTezJRnbkMHmDFccc5ZnWr64LMS3J620AlHKdG8BybAvVW1hGjvWJQyYdZSaTwhLUGoniJ1V+5OnZ29RbH3MofrIUzqsD2ML9Xsw2ZDWWtt5ImKGJ7Ib1wfYWhp3PmkEcFJ1hvXNgKnSdMRMXA== 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)(6916009)(956004)(5660300002)(4326008)(66556008)(1076003)(44832011)(26005)(38350700002)(38100700002)(2616005)(2906002)(316002)(508600001)(8886007)(8676002)(186003)(52116002)(86362001)(36756003)(55016003)(8936002)(33656002)(83380400001)(66946007)(66476007)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7084 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: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4996d2bb-6c50-46ea-6acf-08d9bb0a5e26 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0Frp9QeolMEDZL4NuBRQsjIlVKEW1M/MHoovh5ZDki3gi6dg3R7/cawbbE4ut5ea1P+GktkqRJlmX+xQp6neaB3B8YfshgZdYxQ87y9kwYYt0GNf0lfd5/17zke6dtBXwMh3ZhsZRf50iXb7SAws6rrnu+FCOfvhBjg8qbRm8bsvoEM4yIRtltI7Kwbvse7nGcLFErTuONQzpBcdBR3pdWn5JokxfUhCqesoIIDYnMI9lpLq0NMwOxqXtc9BbKcHE4f1g7WZOW/MZBHWYf6Y66pv1Gr3Al95Q2SsIjzeQJKSW7OmMbFqIlc1UjbHyEXW8Rsbf6aWHvrYYZT8q1rrJ5x2xwwKh+qXDeX5xe3hWAyVw2E9hcxyjN4QmSL8BBtvSO4btLWswclTLqG2Ao2z5ATiTGofREYGBHKlSJhQkcsyBXS9Otk0hv1+86mmXBJnOSvvN9+ENGbUrkf1uN668lAfU4Vd0g0rqEVWeSSFwtPFpXrMYq90SGJkbB/6ALdgpNhl1cWJIxzuteVX7GaWtuV/tWkD/WeqcE5cfb1a/QTwvaI3xmEu4JLcFaZLm35I73LI8jzWbMUA9aNOFljVj+ic7k2W87zTbTp+1YVFgTWfxKDR9sbNAOdnYgqqwp8cp5ZNrVZcW5qsrvqq4wkK+J8Tu57Ow3S/MDsTjBKfGQoyJ4MIUoanhwipNKXCRN5gG0ph1+3O7LLmFRg8uSwO9MFjh19oQ/bPjf1WlCInKPIkWrPzYNrN+zeLOBN3euo/MxnzqIr/twVCPPtY93iFaw== 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)(40470700001)(508600001)(70206006)(33656002)(336012)(5660300002)(8886007)(36860700001)(70586007)(44832011)(55016003)(81166007)(2906002)(2616005)(82310400004)(8676002)(356005)(6862004)(956004)(7696005)(47076005)(86362001)(316002)(4326008)(26005)(8936002)(186003)(83380400001)(36756003)(40460700001)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2021 11:52:35.1187 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3001715a-07a6-49cf-8808-08d9bb0a6403 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: AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2418 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, 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: Thu, 09 Dec 2021 11:52:40 -0000 The 12/08/2021 18:55, Florian Weimer wrote: > * Szabolcs Nagy: > > 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 > > We don't need m68k for rseq, so I haven't added it, but I saw that > __thread_pointer is actually a system call there. Maybe that's why it's > not a universal GCC feature. Furthermore, for many ABIs, the thread > pointer is somewhat implicit. On x86, it took some discussion to figure > out that we actually have a canonical notion of a thread pointer. On > some other targets, the thread pointer is stored explicitly in a > (system) register, but it actually points to nowhere, so that local-exec > TLS access can make better use of immediate instruction operands. i think local-exec tls access has to expose some notion of thread pointer to the compiler (from which a tls variable is at fixed offset). whatever that notion is, __builtin_thread_pointer can be defined based on that and if there is nothing exposed then presumably tls access relies on libc apis so __builtin_thread_pointer can also rely on a libc api (or syscall). tp is useful as a thread identifier and for fixed offset tcb abis. (especially within libc and compiler runtimes) > > It's also annoying that __has_builtin (__builtin_thread_pointer) > evaluates to true even for GCC targets where actually using > __builtin_thread_pointer () results in a compiler error. > > In the future, we could install this as if people > think it's useful (not just in an rseq context). yeah, i would prefer gcc to be fixed.