TLS and x86-64 fs:

Cecil Ward cecil at cecilward.com
Wed Jun 28 23:39:43 UTC 2023


It seems that in x86-64 Linux (which I think is what godbolt.org 
uses - is that correct?), LDC emits a function call to get the 
address of your TLS static base. GDC seems to be vastly more 
efficient as it simply uses an fs: segment override and apart 
from that accesses the RAM directly. I don’t know what is 
happening if someone takes the address of a TLS static and mixes 
it with a comparison or pointer arithmetic with say an alloc cell 
or address in one of the stacks. How that works is a GDC question.

I wonder why the difference in method between the compilers ? 
Could LDC steal the GDC tech here in order to get much more speed 
?


More information about the digitalmars-d-ldc mailing list