Bloat in Executable

Joakim dlang at joakim.fea.st
Thu Nov 16 09:25:22 UTC 2017


On Thursday, 16 November 2017 at 03:32:26 UTC, codephantom wrote:
> // -----------------------------------
> module test;
>
> import core.stdc.stdio;
>
> extern (C) int main()
> {
>     printf("hello world\n");
>     return 0;
> }
> // -----------------------------------
>
>
> compiled with dmd v2.077.0, using the -betterC option, I get:
>
> .. on windows ..
> 23k executable if 32bit (i.e. -m32 )
> 112k executable if 64bit (i.e. -m64 )
>
> .. on freebsd ..
> 5.6k executable if 32bit (i.e. -m32 )
> 7.5k executable if 64bit (i.e. -m64 )
>
> This is not meant to be an anti-windows thing...so let me stop 
> those responses right here.
>
> I am genuinely interested in understanding why the 'order of 
> magnitude' increase for the 64bit executable on Windows?

If you're worried about executable size, you're probably better 
off using ldc on non-Windows platforms, because David made ldc 
work with the linker's --gc-sections.  I don't think that work 
was ever done for dmd, which is why ldc invokes --gc-sections by 
default for non-MSVC targets but dmd doesn't.


More information about the Digitalmars-d mailing list