Mail Archives: djgpp/2001/08/03/04:28:27
> From: cnelson <cnelson AT sandia DOT gov>
> Newsgroups: comp.os.msdos.djgpp
> Date: Thu, 02 Aug 2001 15:53:25 +0100
>
> If you compile a program with
> gcc hello.c
> you get 2 files, "a.out" and "a.exe", that are not identical. What are
> these 2 files and how are they related? My best guess is:
> - a.out is a raw COFF file
> - a.exe is the DOS executable (a.out with a 2048 byte DJGPP DOS stub)
Correct.
> Now if you compile using a command from a UNIX makefile
> gcc -o a hello.c
> you get 2 files "a" and "a.exe". What is "a"? It is the same size as
> "a.out" but they are not identical.
It's also raw COFF file.
> In fact, if you compile a program twice the "right" way
> gcc -o a.exe hello.c
> even the "a.exe" files are not identical. Why is this? Is there
> uninitialized space in the files that gets filled with random bits?
Yes, the sections in the executable file are aligned for optimizing
disk accesses, and the gaps are filled by random garbage. This
misfeature is, by and large, fixed in the development sources, so the
next release will be cleaner.
In the meantime, if you want to get rid of the garbage, I suggest to
create programs like this:
gcc -o foo foo.c
stubify foo
- Raw text -