Alignment of large structures in GCC

Alexey Neyman stilor@att.net
Tue Jul 15 16:10:00 GMT 2008


Andrew,

On 15 July 2008 Andrew Haley wrote:
> > I narrowed it down to the following example:
> >
> > <<<
> > struct {
> >         int xxx[NINT];
> > } aaa __attribute__((section(".foo")));
> > <<<<
>
> Please try making it a one-element array of that struct.  Does that
> fix your problem?

No, it doesn't.

struct {
        int xxx[NINT];
} aaa[1] __attribute__((section(".foo")));

$ gcc -o - -S gg.c -DNINT=9 | grep align
        .align 32

> > The question is, why does GCC perform such 32-byte alignment and is
> > it possible to turn off such behavior globally?
>
> What target is this?  It might be an ABI requirement, or just an
> optimization. Strictly speaking, gcc is allowed to do this.

$ gcc -dumpmachine
i386-redhat-linux

Best regards,
Alexey.



More information about the Gcc-help mailing list