Date: Fri, 03 Aug 2001 11:26:02 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: cnelson Message-Id: <7458-Fri03Aug2001112601+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <3B6906F5.98FAB93A@sandia.gov> (message from cnelson on Thu, 02 Aug 2001 15:53:25 +0100) Subject: Re: Files created by gcc/g77 References: <3B6906F5 DOT 98FAB93A AT sandia DOT gov> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: cnelson > 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