From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6E0573858D3C for ; Wed, 8 Dec 2021 17:56:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E0573858D3C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-MqRYGu0nNR6D0feDTQK17A-1; Wed, 08 Dec 2021 12:56:03 -0500 X-MC-Unique: MqRYGu0nNR6D0feDTQK17A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8BB501006AA1; Wed, 8 Dec 2021 17:56:02 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99BE11971B; Wed, 8 Dec 2021 17:56:01 +0000 (UTC) From: Florian Weimer To: Szabolcs Nagy Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 1/8] nptl: Add for defining __thread_pointer References: <48b399368593be9675a23e7e2dc53f64c46a94d2.1638880889.git.fweimer@redhat.com> <20211208110502.GE3294453@arm.com> Date: Wed, 08 Dec 2021 18:55:59 +0100 In-Reply-To: <20211208110502.GE3294453@arm.com> (Szabolcs Nagy's message of "Wed, 8 Dec 2021 11:05:02 +0000") Message-ID: <87pmq7j80g.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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 17:56:09 -0000 * 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. 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). Thanks, Florian