This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: No Packing in GCC
- From: John Love-Jensen <eljay at adobe dot com>
- To: "Kalinowski, Jeremy" <JKalinowski at microwavedata dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Tue, 16 Jan 2007 11:00:09 -0600
- Subject: Re: No Packing in GCC
Hi Jeremy,
Packing is off by default. At least on the platforms I'm familiar.
You can use the -fpack-struct to enable maximum packing (equivalent to
-fpack-struct=1).
You can use, for example, the -fpack-struct=2 to enable maximum structure
packing on even boundaries. Depending on your platform, the value is
probably required to be a power of 2, and depending on your linker, may top
out.
You can specify minimum alignment (minimum packing) of, say, 2 bytes in the
code by using the __attribute__((align(2))) tag, or packing using the
__attribute((packed)) tag. These would be on a struct-by-struct basis (or
variable-by-variable basis).
Here are the URLs on the documentation:
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Type-Attributes.html
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Code-Gen-Options.html
HTH,
--Eljay