[PATCH v3 1/2] elf(tls): Add debug logging for TLS operations

Florian Weimer fweimer@redhat.com
Thu Feb 5 16:31:10 GMT 2026


* Adhemerval Zanella Netto:

>> diff --git a/elf/dl-tls.c b/elf/dl-tls.c
>> index 8cef809261..708a953185 100644
>> --- a/elf/dl-tls.c
>> +++ b/elf/dl-tls.c
>> @@ -220,6 +220,13 @@ _dl_assign_tls_modid (struct link_map *l)
>>      }
>>  
>>    l->l_tls_modid = result;
>> +
>> +  if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_TLS))
>> +    _dl_debug_printf ("%s: modid %lu assigned to %s [%lu]\n",
>> +		      __func__,
>
> I think dumping implementation details on logging is a good approach
> here, the consumers are not only glibc developers.  I would prefer a
> more descriptive tag than the function name.

Do you mean “I don't think this is a good idea”?

> Would be worth to add similar debug info for other ABI specific TLS routines,
> like sysdeps/aarch64/libc-tls.c?

That's static-only, and only has a fast path, so logging there would be
quite high-volume.

> And, should we be worried about the performance implications on the extra
> branches on the TLS slow path here?

As you said, it's the slow path.  Perfectly predictable branches should
not matter there?

Thanks,
Florian



More information about the Libc-alpha mailing list