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,.tlsDepends on
msvcrt.dllandkernel32.dll
MSVC 2010: Gave a 5.5 KiB executable (compiled with
/MD /Ox)Sections:
.data,.rdata,.reloc,.textDepends on
msvcr100.dllandkernel32.dllCould have been further reduced by merging
.rdatawith.text
Windows Driver Kit 7.1: Gave a 6.5 KiB executable (compiled with
/MD /Ox, linked withmsvcrt_winxp.objto allow it to run on XP)Sections:
.data,.rdata,.textDepends on
msvcrt.dllandkernel32.dllCould have been further reduced by merging
.rdatawith.text
Windows 2003 Driver Development Kit: Gave a 3.5 KiB executable
Sections:
.data,.rdata,.textDepends on
msvcrt.dllCould have been further reduced by merging
.rdatawith.text
Tiny C Compiler (TCC): Gave a 1.5 KiB executable
Sections:
.data,.textDepends 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.)