SPRAB89A September 2011 – March 2014
In both the General and Local Dynamic TLS models, the function __tls_get_addr() is called to get the thread-local variable’s address. The module-id in both the General and Local Dynamic TLS models is obtained from the GOT. The offset is obtained from the GOT in General Dynamic model and as a static link-time constant in Local Dynamic model. In the case of weak undefined reference, there is no thread-local definition to resolve the weak reference. Since there is no definition, the module-id and TBR offset resolve to zero.
For weak thread-local references, there is no change in the code generated to access the references. The R_C6000_TLSMOD relocation and all the R_C6000_TBR relocations resolve to zero if the thread-local reference is weak and there is no definition.
The __tls_get_addr() function returns zero when the module-id and offset are zero. This ensures that an undefined weak reference address is resolved to zero.