File binutils-2.20-coffcode.patch of Package djgpp-binutils
--- binutils-2.17/bfd/coffcode.h.coffcode 2005-10-25 20:40:09.000000000 +0300
+++ binutils-2.17/bfd/coffcode.h 2006-06-29 20:25:47.000000000 +0300
@@ -3343,6 +3343,10 @@
#endif /* COFF_IMAGE_WITH_PE */
+#if defined(__MSDOS__)
+#define COFF_PAD_SECTION_HEADERS
+#endif
+
static bfd_boolean
coff_write_object_contents (bfd * abfd)
{
@@ -3712,6 +3716,19 @@
#endif
#endif
+#ifdef COFF_PAD_SECTION_HEADERS
+ if ((abfd->flags & EXEC_P) != 0)
+ {
+ file_ptr cur_ptr = scn_base
+ + abfd->section_count * bfd_coff_scnhsz (abfd);
+ long fill_size = (abfd->sections->filepos - cur_ptr);
+ bfd_byte *b = bfd_zmalloc (fill_size);
+ if (b)
+ bfd_bwrite ((PTR)b, fill_size, abfd);
+ free (b);
+ }
+#endif
+
/* OK, now set up the filehdr... */
/* Don't include the internal abs section in the section count */