[mips-tls] Revised versions of MIPS TLS ABI specification

Nigel Stephens nigel at mips.com
Thu Nov 4 18:00:53 UTC 2004


Daniel Jacobowitz wrote:

>>The following issue does need resolution:
>>
>>1. Should we extend the 32K Local Dynamic Model to 64K by using a biased 
>>offset?
>>
>>Daniel and I thought this would be more trouble than it's worth; Thiemo 
>>thinks otherwise.  Are there any other opinions?
>>    
>>
>
>I have since learned that PowerPC already does this:
>
>| The PowerPC32 TLS ABI is similar to the PowerPC64 model.  The
>| thread-local storage data structures follow variant I.  The TCB is 8
>| bytes, with the first 4 bytes containing the pointer to the dynamic
>| thread vector. tlsoffset calculations and definition of __tls_get_addr
>| are identical to PowerPC64.  r2 is the thread pointer, and points
>| 0x7000 past the end of the thread control block.  Dynamic thread vector
>| pointers point 0x8000 past the start of each TLS block.  (*) This
>| allows the first 64K of each block to be addressed from a dtv pointer
>| using fewer machine instructions.  The tp offset allows for efficient
>| addressing of the TCB and up to 4K-8 of other thread library
>| information.
>| 
>| (*) For implementation reasons the actual value stored in dtv may point
>| to the start of a block, however values returned by accessor functions
>| will be offset by 0x8000.
>  
>

Hi Daniel

I'd be interested to know where that quoted passage comes from - is it a 
public document, I can't find it with Google?

> Shall we use this model? 


It does sounds like we could use the same trick. But I'd like to 
understand it better. I thought that the problem was that in variant I 
the size of the TCB was indeterminate, so the static linker couldn't 
insert optimised references to initial-exec TLS data as fixed offsets 
from the thread pointer. But the implication of the above is that the 
TCB does have a known, fixed size, so the a fixed offset can now  be 
inserted by the linker, as for variant II. Have I got that right?

Nigel





More information about the mips-tls mailing list