On Wed, Jul 14, 1999 at 06:18:29PM -0700, Tim Hockin wrote:
> We have the fix, I think. Not clone.S, but in
> glibc-2.0.7/linuxthreads/internals.h line 86 we need to tell gcc that this
> struct (_pthread_descr_struct - which defines the offset of a thread's stack
> from a well-aligned, malloc() returned addr) be padded to be aligned
> correctly on an 8byte boundary:
>
> -};
> +} __attribute__ ((aligned(__alignof__(double))));
>
> It's working for us now. Please confirm if it works for you folks, too. A
> bug report has been filed for glibc, though I doubt if anything official
> goes on for 2.0.x, now. Hopefully 2.1.x will fold this in. A thread's stack
> really should always be well aligned :) Funny, the doubles were actually
> calculated right,
It's dangerous though. If the code would have attempted to use a MIPS II
ldc1 / sdc1 instruction to access the floating point number, the code
would have been killed by arch/mips/kernel/unaligned.c.
> but stdio functions use va_arg - which expected double's
> to be aligned, and weren't. The work got done, but it couldn't tell us!
The MIPS ABI wants a 8 byte alignment for the stack and even 16 byte for
ABI64. Now we know what can happen if not :-)
Thanks for your fix,
Ralf
|