• S
    copy the dtv pointer to the end of the pthread struct for TLS_ABOVE_TP archs · 204a69d2
    Szabolcs Nagy 提交于
    There are two main abi variants for thread local storage layout:
    
     (1) TLS is above the thread pointer at a fixed offset and the pthread
     struct is below that. So the end of the struct is at known offset.
    
     (2) the thread pointer points to the pthread struct and TLS starts
     below it. So the start of the struct is at known (zero) offset.
    
    Assembly code for the dynamic TLSDESC callback needs to access the
    dynamic thread vector (dtv) pointer which is currently at the front
    of the pthread struct. So in case of (1) the asm code needs to hard
    code the offset from the end of the struct which can easily break if
    the struct changes.
    
    This commit adds a copy of the dtv at the end of the struct. New members
    must not be added after dtv_copy, only before it. The size of the struct
    is increased a bit, but there is opportunity for size optimizations.
    204a69d2
dynlink.c 42.2 KB