why does DMD compile "hello world" to about 500 _kilobytes_ on Mac OS X [x86_64]?!?

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 5 02:36:10 PDT 2014


Am Tue, 02 Sep 2014 07:03:52 +0000
schrieb "Dicebot" <public at dicebot.lv>:

> On Tuesday, 2 September 2014 at 06:18:27 UTC, Jacob Carlborg
> wrote:
> > On 01/09/14 20:33, Dicebot wrote:
> >
> >> Any reason why it can't work for OSX in a same way? Assuming 
> >> LDC does
> >> emit ModuleInfo & Co sections the same way it does on Linux, 
> >> using OSX
> >> specific alternative to --gc-sections should "just work".
> >
> > It does not emit these sections the same way, at least not on 
> > DMD.
> 
> Well I am speaking about LDC ;) --gc-sections don't work with
> Linux DMD either.

Hey, every new release I go and try it, but found that dub
will still crash when linked with --gc-sections, so some
symbols need to be "added as GC roots".

That said with -defaultlib=phobos2 (picking up the .so
version) the file size is:

                   48 KiB  !!!

after `strip main` it comes down to:

                   34 KiB  !!!

Only when you think about how people put 5 minutes of a
stunning 3D gfx demo into 64 KiB you start to worry about 34
KiB for "Hello World!" again.

-- 
Marco



More information about the Digitalmars-d mailing list