DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 51BNsTms546507 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 51BNsTms546507 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=ZgNP5fyX X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1371A3858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1739318068; bh=Ekuv6oy4MSRMe2c6g3LxRpL1csQdEwxgqtwaHhIWgZ4=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ZgNP5fyXEFV+cIfC7K2cShG7qf75eBim7QDZY7UzemymDej1bGkE7rhr60Pg+PhUy A6XnyveLN0p2qmnM6qd/vpRrxgn19ErIzjIMYJAzwrmPAKakro+3y8RkssKInbFJF0 qi5gdukoCAESNsxFDnKsCCJY011W/69/1Q2AEA/o= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74ABB3858D39 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74ABB3858D39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739318011; cv=none; b=QnbIIOWaTp1xrdJ6KiQtmfnl59BlpEnAfWTPQ0xIJ7WQks1f6FYjNYvZrcYfHrfaoVxoy1cnTh+xeRTyOSM0V5VFhlqp89bzLHZhSeXPm25+fvtS2ErlrEi7z3Zlg0PrMR+KtAIoSFnfZkZ/dvTlhrTjoX5hNayIac3PDSWwF6o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739318011; c=relaxed/simple; bh=EA3EQpvl+6WweHFvrvaq2nrCgj7V9ReRN6dHshFG8zo=; h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature; b=m81l2nVerf59uDEEBW6NWtd+xSeAx0Ej8QFf5h4/zN6jEhWABlITfei/zDv8UfqgOyO3YJGInZq+4Pi3m4/ZsBztTr/Bbf5BW12KhPiEfNAr0Hgp+rPx6Jtf9kjSWvBm9oULk/6jPD31eKS4Q6JY7pSKosLS1dENfWCiBd+2FvI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74ABB3858D39 Message-ID: <4eb423e0-cfbb-48d5-a8ed-5a255bd712a1@SystematicSW.ab.ca> Date: Tue, 11 Feb 2025 16:53:28 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: __builtin_thread_pointer Content-Language: en-CA To: The Cygwin Mailing List References: <9c6a1ccc-d2fb-4aaf-b8c2-29574fa640b4 AT cornell DOT edu> <6faedefc-eb17-4b02-89b9-44b73e82d43f AT SystematicSW DOT ab DOT ca> <0252F948-10C3-4B9E-943D-ACA35E190726 AT unified-streaming DOT com> Autocrypt: addr=Brian DOT Inglis AT SystematicSW DOT ab DOT ca; keydata= xjMEXopx8xYJKwYBBAHaRw8BAQdAnCK0qv/xwUCCZQoA9BHRYpstERrspfT0NkUWQVuoePbN LkJyaWFuIEluZ2xpcyA8QnJpYW4uSW5nbGlzQFN5c3RlbWF0aWNTdy5hYi5jYT7ClgQTFggA PhYhBMM5/lbU970GBS2bZB62lxu92I8YBQJeinHzAhsDBQkJZgGABQsJCAcCBhUKCQgLAgQW AgMBAh4BAheAAAoJEB62lxu92I8Y0ioBAI8xrggNxziAVmr+Xm6nnyjoujMqWcq3oEhlYGAO WacZAQDFtdDx2koSVSoOmfaOyRTbIWSf9/Cjai29060fsmdsDM44BF6KcfMSCisGAQQBl1UB BQEBB0Awv8kHI2PaEgViDqzbnoe8B9KMHoBZLS92HdC7ZPh8HQMBCAfCfgQYFggAJhYhBMM5 /lbU970GBS2bZB62lxu92I8YBQJeinHzAhsMBQkJZgGAAAoJEB62lxu92I8YZwUBAJw/74rF IyaSsGI7ewCdCy88Lce/kdwX7zGwid+f8NZ3AQC/ezTFFi5obXnyMxZJN464nPXiggtT9gN5 RSyTY8X+AQ== Organization: Systematic Software In-Reply-To: <0252F948-10C3-4B9E-943D-ACA35E190726@unified-streaming.com> X-Rspamd-Queue-Id: 64ECE20031 X-Stat-Signature: cd6qo3x3z55jrw851eswwm1uahz8qdd9 X-Rspamd-Server: rspamout03 X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX1+cp3LjDPB2HcT3uzvfy/Y45vk7v7BSdUw= X-HE-Tag: 1739318009-642280 X-HE-Meta: U2FsdGVkX18g41/eArJrVTVczFRsoTxp/pjCGc6mQwGNr4RqZADwuDXEOmdkI/fV8eddRk7xfoSgzEP6Zm86GgDzJTWAEG5fiJF85d0+WHucoOjsX6tcVTwjdS20pBUgkOepeMXFCqd5Qg1DnZDZmIaao5EJ7S3i2tV0Op+QrMJ2X9PQ1eabkWypWpR6acikOnrhk58n1PSuYmSnxjIGOibtJydJUjiXLd7ULdFf77iImYrqnPRU2H/saJHJLZA4cotcKO6TtRHpc/hVMUb71WzFs0ZFdLprnTiRgjhiEMCPPk8cUyIoGkyK0Qim54x1bag6UD/g3jfPtHw/QSMhzEJiabvvR//M X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 51BNsTms546507 On 2025-02-11 13:58, Dimitry Andric wrote: >> On 11 Feb 2025, at 21:45, Brian Inglis via Cygwin wrote: >> On 2025-02-11 12:41, Dimitry Andric via Cygwin wrote: >>>> On 11 Feb 2025, at 20:26, Ken Brown via Cygwin wrote: >>>> Does Cygwin support __builtin_thread_pointer? I'm guessing not, because >>>> I'm getting a link error (undefined reference to >>>> `__builtin_thread_pointer') when I try to build some software that uses >>>> it. Or is there something that would have to be added to the link command >>>> line? The full command line and error message are quoted below, in case >>>> anyone spots something obvious. >> >>> It's a gcc builtin function, not something implemented in an external library. Therefore, there is no linker option that can fix this. >>> Also, as far as I can see from gcc's documentation, >>> __builtin_thread_pointer() is only supported for the RISCV and SH >>> architectures. Then again, gcc's implementation seems to hinge this on >>> whether the platform supports TLS or not. >>> In any case, it is probably better to not use this function if your gcc does >>> not support it. >> Does `info gcc tls` help and do we know if that is supported by our gcc(s)? > It does not look like it's supported by Cygwin's gcc: > > $ gcc -v > Using built-in specs. > COLLECT_GCC=gcc > COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/12/lto-wrapper.exe > Target: x86_64-pc-cygwin > Configured with: /mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-12.4.0/configure --srcdir=/mnt/share/cygpkgs/gcc/gcc.x86_64/src/gcc-12.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --with-gcc-major-version-only --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --enable-clocale=newlib --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++,jit --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --disable-multilib --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts > Thread model: posix > Supported LTO compression algorithms: zlib zstd > gcc version 12.4.0 (GCC) > > $ cat test-builtin-thread-pointer.c > void f(void) > { > void *p = __builtin_thread_pointer(); > } If you read the docs at `info gcc tls` it uses the __thread storage class to allow you to declare auto, extern, or static thread variables like any other. Whether that would run as expected is more than I can deduce. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry -- 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