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

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Feb 5 17:20:19 GMT 2026



On 05/02/26 13:31, Florian Weimer wrote:
> * 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”?

Oops, yeap I think it is *not* 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.

Ack.

> 
>> 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?

I guess so, just checking if someone would have a different opinion. 


More information about the Libc-alpha mailing list