www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/02/12/13:59:25

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 51CIxPwg885539
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 51CIxPwg885539
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=ByPon88G
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81DE5385841E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1739386763;
bh=FyjqNB5aJhFPGZoZwxb0U+08oTJdKXfTUjYfbhmtOrQ=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=ByPon88GN5uyz9tbNOIfQU4MdnC5vmjTVDTwQYUQZv0OqviHvkLUZ+BmKZ7X2tMbh
s3ICW4WhimmNDWnsVlUcHECy85ej7neq8cZ9R3NuunGYsBwadMtk3ovxGnXfeIxXfo
/77NBADgwXstZXpD9yVSTA6BYeKY+VnzOLT7TPEM=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0E6E3858C53
Date: Wed, 12 Feb 2025 19:57:50 +0100
To: cygwin AT cygwin DOT com
Subject: Re: __builtin_thread_pointer
Message-ID: <Z6zvLkm9IFAtm0jR@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <9c6a1ccc-d2fb-4aaf-b8c2-29574fa640b4 AT cornell DOT edu>
<D47E777E-C732-47BD-81C8-5A488E38E1F3 AT unified-streaming DOT com>
<6faedefc-eb17-4b02-89b9-44b73e82d43f AT SystematicSW DOT ab DOT ca>
<0252F948-10C3-4B9E-943D-ACA35E190726 AT unified-streaming DOT com>
<87935cbb-4a43-4ebd-b8cb-125ecfcbcdc3 AT SystematicSW DOT ab DOT ca>
<BE17AA1A-EA85-40C9-AE04-46E689B27FF8 AT unified-streaming DOT com>
MIME-Version: 1.0
In-Reply-To: <BE17AA1A-EA85-40C9-AE04-46E689B27FF8@unified-streaming.com>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

On Feb 11 23:52, Dimitry Andric via Cygwin wrote:
> Yes, that is the RISCV or SH specific method. On x86_64, you access it via the fs register, i.e. gcc (on Linux at least :) compiles:
> 
>   void *p = __builtin_thread_pointer();
> 
> to something like:
> 
>   	movq	%fs:0, %rax
> 	movq	%rax, -8(%rbp)
> 
> If somebody knows how to build the Cygwin gcc package from scratch,
> they could inspect the config.log file, to see what that says about
> TLS detection.

https://cygwin.com/pipermail/cygwin/2025-February/257300.html

As I wrote it's different on Windows and there's no good equivalent.

On Windows, %fs points to the TEB on 32 bit x86, while it's %gs on
x86_64.

The TEB is not the same thing as the TCB in NPTL, which is what
__builtin_thread_pointer() returns.

I don't think we can implement this in a way which is even marginally
similar...


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019