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

Paul Koning pkoning@equallogic.com
Tue Dec 5 16:06:00 GMT 2006


>>>>> "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.

	 paul



More information about the Binutils mailing list