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

Nick Clifton nickc@redhat.com
Tue Dec 5 15:53:00 GMT 2006


Hi Michael,

> The issue is the alignment/padding added on ARM, such that the effective size
> (as reported by sizeof) is 2 bytes larger than the #define'd sizes.

Is it possible to provide a test case that demonstrates this please ?

> This causes
> invalid coff files to be generated by gas. The attached patch fixed all problems
> while building gcc packages for the h8300-hitachi-coff target.

Built by what compiler ?  On what host machine ?

> --- 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;

Since the packed attribute is specific to gcc it ought to be protected 
by an #ifdef,  ie:

   }
   #ifdef __GNUCC__
   __attribute__((packed))
   #endif
   ;

Also patches need to be accompanied by an entry for the ChangeLog so 
that other people can see what has changed and why.

Cheers
    Nick



More information about the Binutils mailing list