[PATCH v1 0/2] Add debug logging and documentation for TLS management
Frédéric Bérat
fberat@redhat.com
Tue Oct 28 15:32:57 GMT 2025
Hello,
This patch series introduces debugging capabilities for Thread-Local
Storage (TLS) management within the dynamic linker and documents the
relevant environment variables.
The first patch adds the `DL_DEBUG_TLS` debug mask, which can be enabled
via the `tls` keyword in the `LD_DEBUG` environment variable. This
provides detailed logging for TCB allocation, deallocation, and reuse,
as well as thread startup events. A new test is included to validate
this functionality.
The second patch adds a new section to the dynamic linker manual,
documenting the `LD_DEBUG` and `LD_DEBUG_OUTPUT` environment variables.
This includes documentation for the newly added `tls` keyword.
These changes enhance the dynamic linker's debuggability for TLS-related
issues and improve the documentation for users. This is a first step,
and the intent is to extend this logging in the future to cover more
aspects of TLS management.
Fred.
Changes since v0:
- Slightly reworked the test to remove the sleep and quote inputs
- Updated a few comments for clarity
- Moved one of the logs before de-allocation
The 2nd patch is untouched (although I added reviewed-by), but there is
no point in pushing it yet as it depends on the first.
---
Frédéric Bérat (2):
tls: Add debug logging for TLS and TCB management
docs: Add dynamic linker environment variable docs
elf/dl-tls.c | 6 ++++
elf/rtld.c | 4 ++-
manual/dynlink.texi | 66 ++++++++++++++++++++++++++++++++++
nptl/Makefile | 7 ++++
nptl/allocatestack.c | 14 ++++++++
nptl/nptl-stack.c | 23 ++++++++++--
nptl/pthread_create.c | 4 +++
nptl/tst-dl-debug-tid.c | 69 ++++++++++++++++++++++++++++++++++++
nptl/tst-dl-debug-tid.sh | 72 ++++++++++++++++++++++++++++++++++++++
sysdeps/generic/ldsodefs.h | 3 +-
10 files changed, 264 insertions(+), 4 deletions(-)
create mode 100644 nptl/tst-dl-debug-tid.c
create mode 100644 nptl/tst-dl-debug-tid.sh
--
2.51.0
More information about the Libc-alpha
mailing list