This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] coff: fix alignment issues when building on ARM


On Tue, Dec 05, 2006 at 11:05:52AM -0500, Paul Koning wrote:
> >>>>> "H" == H J Lu <hjl@lucon.org> writes:
> 
>  >>--- binutils-h8300-hms-2.16.1.orig/include/coff/external.h
>  >>+++ binutils-h8300-hms-2.16.1/include/coff/external.h
>  >>@@ -50,7 +50,7 @@
>  >>     char entry[4];	/* entry pt.				*/
>  >>     char text_start[4];	/* base of text used for this file 	*/
>  >>     char data_start[4];	/* base of data used for this file 	*/
>  >>-  }
>  >>+  } __attribute__((packed))
>  >> AOUTHDR; 
> 
>  H> All fields are char []. Why is __attribute__((packed)) needed?
> 
> Perhaps because some compilers pad even when they would not be
> expected to do so?
> 
> It's unusual, but apparently legal, to align fields to boundaries
> larger than their size (or the array element size).  I remember an
> Intel i680 compiler (derived from GCC) that did this, much to the
> surprise of people defining packet format layouts via structs.
> 

Then __attribute__((packed)) is need for all external structs.

H.J.


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