[PATCH v3] elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717)

Florian Weimer fweimer@redhat.com
Fri Jun 14 13:24:09 GMT 2024


* Simon Chopin:

>> +/* Second half of test, behind a compiler barrier.  */
>> +void call_tlsreinitmod3_tail (void *self) __attribute__ ((weak));
>
> I'm a bit confused about what constitutes the compiler barrier here? Is
> that just because of the weak attribute?

Yes, it indicates to the compiler that the symbol can be interposed from
somewhere else.  Otherwise, you have to use noinline and noipa, and not
all GCC versions support the latter.

> Also, I'm not clear on the need for a barrier in the first place, what
> are the operations that we fear would be reordered here?

It's about the implicit __tls_get_addr call to implement dynamic TLS.
I'm going to add a comment.

Thanks,
Florian



More information about the Libc-alpha mailing list