Subject: Re: amd64 alignment problem - gcc's fault or libpthread's?
To: Matthias Drochner <>
From: Frank van der Linden <>
List: tech-toolchain
Date: 02/27/2004 17:20:32
On Fri, Feb 27, 2004 at 05:02:24PM +0100, Matthias Drochner wrote:
> I've found that programs using "va_start" occasionally
> dump core because the vararg code involves "movaps"
> instructions, but the stack location is not aliged
> properly (needs 16-byte alignment).
> I've submitted a bug report to gcc about this (c/14321).
> Now, after thinking about it, I'm not quite sure
> anymore that this is really gcc's fault.
> I could only trigger the problem if the vararg using
> code is called from a thread. I don't know the ABI
> requirements, but in case a 16-byte stack alignment
> is required, and our libpthread doesn't ensure it,
> it would be libpthread's fault.

Yes, the ABI requires a 16-byte stack alignment. If libpthread
doesn't do this, it's libpthread's fault.

The stack setup in libpthread is.. well. I don't like it. I thought
I tested printfs, though.. but apparently they broke.

The movaps instruction is used to save the float arguments pased
to the varargs function (passed in %rax).

- Frank