From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id tDLSI/Q0/mnZUSQAWB0awg (envelope-from ) for ; Fri, 08 May 2026 15:09:40 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=ENFX2C54; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7EBC21E0BA; Fri, 08 May 2026 15:09:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 97DFC1E067 for ; Fri, 08 May 2026 15:09:39 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F16E84BA2E16 for ; Fri, 8 May 2026 19:09:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F16E84BA2E16 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=ENFX2C54 Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 12FD84BA5439 for ; Fri, 8 May 2026 19:09:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12FD84BA5439 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 12FD84BA5439 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778267351; cv=none; b=wUGC0oP4Kq5ine5bJPG3HLl2Ww//UGoUYjWlWrK9X9E0xTcipp+1UH0oLrlYRW7TMzS0hNNOLwuOX4WdNPgMoknkq6ZbmV/KZLPY4d34jfLSZbtOXa8D7waT9gNxBU4umIevh/1o90CLcLlY1e7iNT7coDOarkWhtA6q0VXelpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778267351; c=relaxed/simple; bh=VSQjhHlk//9d8f9ZLhKaKxtMuCLyRJxkHvrL6A/wt6g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=agrok8vdnWDBvABr3OYTFqi5um4Hr1goDfbJO/ovVatf/xbrgbLfMuoR4dwxV51+1HNd6CC/aFq9WTtXWmFMKX7Au3PUMMxlIuqlozbFaMuH5K3YIEPvp4DqjebrPNE4Hd+lrGTjbzsFYc6X/h7KR+lNe6+UIsG9RoRR30wo0h8= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=ENFX2C54 reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12FD84BA5439 Received: from eig-obgw-5004b.ext.cloudfilter.net ([10.0.29.208]) by cmsmtp with ESMTPS id L4pqwVGubshqQLQZSwwEQg; Fri, 08 May 2026 19:09:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id LQZRwK7EFcvlfLQZRwPIy0; Fri, 08 May 2026 19:09:09 +0000 X-Authority-Analysis: v=2.4 cv=LtSSymdc c=1 sm=1 tr=0 ts=69fe34d5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=NGcC8JguVDcA:10 a=ItBw4LHWJt0A:10 a=oVtFo90zzRr6sXpmy7wA:9 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ScEy6zzBofXB/IczU5SoMEoYeuJO5uvRfRz+eovR2T8=; b=ENFX2C546Ujocpwdft7waPJdep L69RtZBmGDhIuZOiMIjqcTf0Pi69pIpHf5I6zVcltZeA+Fna+x70a/6L46iUNN/HNBt8WkWv0G7k8 a7NgYlb6el1DlgtVlPNyJraLU; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:42318 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wLQZQ-00000000uxN-3XGu; Fri, 08 May 2026 13:09:08 -0600 From: Tom Tromey To: Hannes Domani Cc: gdb-patches@sourceware.org Subject: Re: [RFC PATCH] Implement native TLS support on Windows In-Reply-To: <20260508144232.940078-1-ssbssa@yahoo.de> (Hannes Domani's message of "Fri, 8 May 2026 16:42:28 +0200") References: <20260508144232.940078-1-ssbssa.ref@yahoo.de> <20260508144232.940078-1-ssbssa@yahoo.de> X-Attribution: Tom Date: Fri, 08 May 2026 13:09:07 -0600 Message-ID: <87tsshn2gc.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wLQZQ-00000000uxN-3XGu X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:42318 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfB42/OUgyAk66ccOKFJMs6TJ1f+cq7DHEIJk6eiIwNeoLgh33tt/iG0j6JLVTMbiOlkOE8jKaWvlg+yap1o7WIBo9KUxeKWuLwAuz1Js2676ENfpxDaD Q5WbOtBcokHhh9NYZZ8eJc8gDRjkTafMfLPYmsBUdw0ud4tnrrs1s/7hn4cF8ixwZqGDnF2zF3NGjYcmbIrNUZpIUZsXUSN2dL4= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >>>>> "Hannes" == Hannes Domani writes: Hannes> I've used the fetch_tls_load_module_address gdbarch method to get the Hannes> address of _tls_index of the OBJFILE, which is then forwarded as LM_ADDR Hannes> to windows_get_thread_local_address, but I'm not really sure if this is Hannes> allowed. I think it is fine, or at most would need a small update to the comment string explaining that the values are opaque and intended to be target-specific. Hannes> +/* Get the address of variable "_tls_index" of OBJFILE. */ Hannes> + Hannes> +static CORE_ADDR Hannes> +windows_tls_index_address (struct objfile *objfile) Hannes> +{ Hannes> + bound_minimal_symbol minsym Hannes> + = lookup_minimal_symbol_linkage("_tls_index", objfile, false); Missing space. Hannes> + gdb_byte buf[8]; Hannes> + if (target_read_memory (lm_addr, buf, 4)) Hannes> + throw_error (TLS_GENERIC_ERROR, _("Cannot read _tls_index")); Hannes> + Hannes> + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); Hannes> + uint32_t tls_index = extract_unsigned_integer (buf, 4, byte_order); Hannes> + CORE_ADDR tlb, tls_ptr, slot_ptr; Hannes> + if (target_get_tib_address (ptid, &tlb) Hannes> + && !target_read_memory (tlb + tls_offset, buf, ptr_bytes) Hannes> + && (tls_ptr = extract_unsigned_integer (buf, ptr_bytes, Hannes> + byte_order)) != 0 Hannes> + && !target_read_memory (tls_ptr + tls_index * ptr_bytes, Hannes> + buf, ptr_bytes) Hannes> + && (slot_ptr = extract_unsigned_integer (buf, ptr_bytes, Hannes> + byte_order)) != 0) Instead of multiple assignments in an 'if' I think it'd be better to have separate 'if's and early returns. Tom