When I compiled a no-op program:
int main(void)
{
return 0;
}
with various compilers:
GCC (similar result to LLVM as well): Gave a 10-KiB executable (compiled with
-s
)Sections:
.CRT
,.bss
,.data
,.idata
,.rdata
,.text
,.tls
Depends on
msvcrt.dll
andkernel32.dll
MSVC 2010: Gave a 5.5 KiB executable (compiled with
/MD /Ox
)Sections:
.data
,.rdata
,.reloc
,.text
Depends on
msvcr100.dll
andkernel32.dll
Could have been further reduced by merging
.rdata
with.text
Windows Driver Kit 7.1: Gave a 6.5 KiB executable (compiled with
/MD /Ox
, linked withmsvcrt_winxp.obj
to allow it to run on XP)Sections:
.data
,.rdata
,.text
Depends on
msvcrt.dll
andkernel32.dll
Could have been further reduced by merging
.rdata
with.text
Windows 2003 Driver Development Kit: Gave a 3.5 KiB executable
Sections:
.data
,.rdata
,.text
Depends on
msvcrt.dll
Could have been further reduced by merging
.rdata
with.text
Tiny C Compiler (TCC): Gave a 1.5 KiB executable
Sections:
.data
,.text
Depends on
msvcrt.dll
So I guess the question is simple:
Is it possible to further reduce GCC or LLVM's target executable sizes so that they are closer to the bare-minimum possible, while still linking to msvcrt.dll
?
(Edit: I'm obviously not looking for packers like UPX
, etc.)