This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fb41e5e8cb34306f31bd1ba107b212e5ca777800 Author: Marco Casaroli <[email protected]> AuthorDate: Mon Oct 19 11:53:11 2026 +0200 Documentation: Describe the per-thread emutls of libc. libc now provides its own __emutls_get_address(), so a __thread variable has one copy per thread also with a single-thread libgcc. The TLS guide said that libgcc's emutls implements the keyword. It now also says when the copies are freed, that the links use --wrap, and that code loaded at run time finds the libc version in the system symbol table. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- Documentation/guides/concurrency/thread_local_storage.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/guides/concurrency/thread_local_storage.rst b/Documentation/guides/concurrency/thread_local_storage.rst index f78e036c8b5..b3e98313d7c 100644 --- a/Documentation/guides/concurrency/thread_local_storage.rst +++ b/Documentation/guides/concurrency/thread_local_storage.rst @@ -43,3 +43,7 @@ To confirm that your compiler supports TLS, you can try this command: Then you can see ``--disable-tls`` in the output, which means that your compiler does not support TLS. In this case, you can still use the thread local relative keyword, but it would be implemented by libgcc's emutls. + +NuttX's libc provides its own version (``CONFIG_TLS_EMUTLS``, set for the GCC and clang toolchains when libgcc is the builtin library, ``CONFIG_BUILTIN_TOOLCHAIN``; the sim has it with GCC and the GNU linker, as on Linux and MinGW), and the link sends the calls to ``__emutls_get_address()`` there with ``--wrap``. A libgcc built with the single thread model (``Thread model: single`` above) keeps one copy of each variable for the whole program; with the libc version, each thread gets its o [...] + +The image, the modules and the programs of a kernel build are linked with ``--wrap``; code loaded at run time finds the libc version in the system symbol table (``CONFIG_EXECFUNCS_SYSTEM_SYMTAB``).
