Status of threading and TLS

Marcel Moolenaar xcllnt at mac.com
Fri Sep 1 18:45:36 UTC 2006


On Sep 1, 2006, at 11:40 AM, Peter Grehan wrote:

> Hi Marcel,
>
>> If anyone has any suggestions why for libpthread we end up
>> with r2 off by 8 bytes, I'm happy to hear it...
>
>  I don't have access to a PPC machine at the moment, but would it  
> have anything to do with:
>
> struct ppc32_tp {
>         void            *tp_dtv;        /* dynamic thread vector */
>         uint32_t        _reserved_;
>         double          tp_tls[0];      /* static TLS */
> };
>
>  I think the last element was put in for alignment, but would that  
> possibly have an effect somewhere else, in that it's forcing an 8- 
> byte pad somewhere ?

I've been thinking about that too. I played with the following  
definition
to see if it made a difference:

union ppc32_tp {
	void *tp_ptr[2];
	double _align_;
};

It didn't make a difference :-/
Note that I use the same on ia64, except that on ia64 we need it  
aligned on
a 16-byte boundary. Hence, the definition is:

struct ia64_tp {
	void *tp_dtv;
	uint64_t _reserved_;
	long double tp_tls[0];
}

It doesn't cause problems on ia64...

-- 
Marcel Moolenaar
xcllnt at mac.com




More information about the freebsd-ppc mailing list