This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Switch to turn off data alignment in arm-elf-gcc


On Mon, Jan 08, 2001 at 02:36:19PM -0500, Lewin A.R.W. Edwards wrote:
> I'm SURE this is an RTFM but I can't find this in the man page... what is 
> the command-line switch to turn off structure alignment in arm-elf-gcc? For 
> example in the following structure:
> 
> // Master Boot Record
> typedef struct {
> 	unsigned char fill[0x1be];	// boot code
> 	PARTENTRY partitions[4];	// partition table
> 	unsigned char sig_55;		// 55h boot signature
> 	unsigned char sig_aa;		// AAh boot signature
> } MBR, *PMBR;

You need to add

__attribute__ ((packed))

to the end of the declaration.  

Its documented in the gcc info pages. Look at the section, "Specifying
Attributes of Types"

        Andrew

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]