Interesting series on linker internals

IGotD- nise at nise.com
Sun Jul 12 20:42:10 UTC 2020


On Sunday, 12 July 2020 at 09:25:18 UTC, Johan wrote:
> Hi all,
>   I recently found this series of articles by one of the 
> authors of the gold linker.
>
> The series begins here: https://www.airs.com/blog/archives/38
> Just ++ the number at the end to get to the next article in the 
> series.
>
> One particular interesting one is part 7 (44), where he 
> explains an optimization performed by the linker around `call 
> ___tls_get_addr`.
>
> cheers,
>   Johan

It's a good read for D developers so that they understand what is 
going on underneath the TLS variables. My personal opinion about 
TLS is that it is a zoo. A lot of complexity for rather little 
extra functionality. Not only does TLS variables take more time 
to access, thread creation itself is more complex. The ELF TLS 
specification also doesn't cover language specific initialization 
just copy and zero initialization, then for D you have to call a 
function in order to initialize the TLS objects (double 
initialization).

My advise is, do not use TLS variables at all as far as you can. 
I wish we could rewrite history with this one.



More information about the digitalmars-d-ldc mailing list