> From: Charles Bailey <charl****@comca*****> > Date: Fri, 20 Mar 2020 17:15:09 -0500 > > When I compile this with TCC I get a .exe file that is just 1,536 > bytes. With gcc from MinGW I get a .exe that is 42,035 bytes long. > Executing the strip command on it to remove debug symbols brings it down > to 19,470 bytes, which is still more than 12 times the size of the > TCC-produced file. TCC is "Tiny C". The "tiny" part is there for a reason. You get smaller executables, but also less functional executables. > I recently learned how to use the dumpbin command from Microsoft to > analyze an .exe file. No need to use proprietary tools. If you can build MinGW programs, you have GNU Binutils installed, and if you have Binutils, you have a program named objdump.exe, which is the moral equivalent of dumpbin. E.g., "objdump -x small.exe" will show you the information you posted. > What is all that extra stuff that MinGW is inserting? Why is it > referencing tons of functions that I'm not even using? Are there some > gcc options I can specify to eliminate that extra stuff? I suggest to install the MinGW runtime sources, and look at the MinGW startup code there. You will find the answers to all your questions. In a nutshell, the MinGW startup code does more than the TCC one does, for example it includes a saner expansion of wildcards specified on the command line.