Mail Archives: djgpp-workers/2000/06/29/00:29:27
Hi folks,
I have come up with an experimental patch that get rid of the garbage that appears in
the exectuables. Typically, I see snatches of source code in mine. If your adventurous,
try out the patch and see if it works for you. I deliberately made the fill character
'Z' so it would obvious where the fill takes place. It also makes it obvious if
something besides empty space is overwritten when using objdump and friends. The final
patch will of course use the null character.
*** bfd/coffcode.h.orig Mon Jun 19 12:23:26 2000
--- bfd/coffcode.h Wed Jun 28 21:29:16 2000
*************** coff_write_object_contents (abfd)
*** 3880,3885 ****
--- 3880,3904 ----
}
#endif
+ #define COFF_PAD_EXEC_HEADER
+ #ifdef COFF_PAD_EXEC_HEADER
+ if (abfd->flags & EXEC_P)
+ {
+ /* Fill the bytes between the end of the headers
+ and the start of the first section. */
+ long curpos = bfd_tell (abfd);
+ long first_sectpos = abfd->sections->filepos;
+ long fill_size = first_sectpos - curpos;
+ if (fill_size > 0)
+ {
+ bfd_byte *b = bfd_malloc (fill_size);
+ memset (b, 'Z', fill_size);
+ bfd_write ((PTR)b, 1, fill_size, abfd);
+ free (b);
+ }
+ }
+ #endif
+
/* now write them */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
- Raw text -