This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch to generate align 0 for packed attributes
- To: Chandra Chavva <cchavva at cygnus dot com>
- Subject: Re: patch to generate align 0 for packed attributes
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 04 Aug 2000 10:54:05 -0600
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <Pine.SOL.3.91.1000727114220.23599T-100000@emperor.cygnus.com>you
write:
> > My first question, I'm guessing that the belief is that the MIPS assemble
> > is automatically aligning data to their natural boundary?
> >
> In the example i mentioned, the compiled generates
>
> .byte 1
> .half 2
>
> In the mips assembler, the .byte directive is aligned to 0 and the
> .half directive is aligned to 1 generating the above to
>
> address value
> 0000 01 .byte 1
> 0001 00 0200 .half 2
>
> In the assembler, the directives are aligned only if .align is not zero.
OK. So, the MIPS assembler does auto-align on .byte/.half, etc directives
and .align 0 turns off auto alignment. Got it. Thanks for the code
fragments.
> > Second, do all MIPS assemblers do this? If not, then we need to test for
> > it using autoconf.
To answer my own question, after peeking at the GAS sources and reading its
comments I believe that all MIPS assemblers have this behavior.
> > Third, you didn't include any documentation on the new target macros.
> >
> Yes i realized this after i sent out the patch.
But it's not needed with the updated patch. So I'll withdraw this objection.
> > Fourth, I would be very leery of this code since it appears to be laying
> > out bitfields within structures. If you do it wrong, you'll break ABI
> > compatibility.
>
> Yes my patch is wrong as it align's to 0 for every element of a struct.
> Here is the revised patch.
>
> Please let me know it is okay to apply.
>
> Thanks
> Chandra
>
>
> * varasm.c (output_constructor): Add .align 0 for packed vars.
This is fine. Please install this patch.
Thanks for your patience and explaining things to me,
jeff