Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Stack alignement with pthreads



On Friday, at 14:38, Matthias Drochner wrote:
| But I've just tried your test on an amd64/Linux box with gcc-4.2,
| with the alignment set to 4096. It doesn't work - the pointer
| is 16-byte aligned but not more. So it might well be that
| a large alignment attribute has no effect.

On i386 the maximum alignment is 128bits. I don't know for amd64 but 4096
(bytes?) is likely to be above the max. If it's 16bytes aligned with
__aligned__(16) then that's fine :)

From the gcc info page :
`` If your linker is
   only able to align variables up to a maximum of 8 byte alignment,
   then specifying `aligned(16)' in an `__attribute__' will still
   only provide you with 8 byte alignment. ''

I checked makecontext() for netbsd/i386 and it rounds up the stack pointer to
16bits, which is excatly what gcc defines as the mimimum requirement (from
gnu/dist/gcc4/gcc/config/i386/i386.h). So I see nothing wrong here. And the
stack is aligned on a page anyway ...

More tests with gcc 4.2 soon ...
-- 
Anthony


Home | Main Index | Thread Index | Old Index