ld68k coff again

Nick Clifton nickc@redhat.com
Thu Oct 4 16:55:00 GMT 2007


Hi Bruno,

> The size of the sources files and their object files are :
> dtb00.S :	10 bytes
> list.S:         4 bytes
> descr001.S	8 bytes
> 
> But the size of the linked file is 24 bytes
> 
> It seems that a word is added by the linker at the end of the linked
> file and I don't know how to remove it.

You have run into a limitation of the COFF file format.  With COFF all(*) 
sections have a 4 byte alignment, so the output section is padded to a 4 byte 
boundary.

There are two possible solutions to your problem:

   1.  Switch to a better file format.  (Go on, do it.  You know that ELF makes 
sense... :-)

   2.  Hack the assembler and linker so that the default section alignment is 
two bytes instead of four.  The attached patch will do this.  You will have to 
build and install the assembler and linker of course.

Cheers
   Nick

(*) There are a few exceptions, but they have fixed names.  You cannot just 
choose the alignment for an arbitrary section.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coff-m68k.c.patch
Type: text/x-patch
Size: 889 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20071004/d7879d94/attachment.bin>


More information about the Binutils mailing list