11.10.4.3 Implementation details for the curious

TLS spaces are initialized with an initialization template, much like other data initialization with XC-DSC. Some implementations 'copy' a block of RAM to a newly allocated TLS variable, but typically dsPIC devices are more RAM constrained than Flash. We already have an initialization template for the initial block of RAM. We re-use this template when initializing future TLS blocks, saving some RAM.

All TLS blocks are accessed through __current_tcb. The address of a __thread variable in the object file, listed from xc-dsc-objdump, will be the offset into the __current_tcb and not an absolute address.