why does DMD compile "hello world" to about 500 _kilobytes_ on Mac OS X [x86_64]?!?
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 1 10:28:13 PDT 2014
On Monday, 1 September 2014 at 17:23:03 UTC, Dan Olson wrote:
> Jacob Carlborg <doob at me.com> writes:
>
>> On 01/09/14 01:51, Abe wrote:
>>
>>> The question: why is Hello World so frickin` huge?!?
>>
>> The runtime and standard library is statically linked,
>> compared to C
>> where it's dynamically linked. Also unnecessary symbols are not
>> stripped. DMD on OS X doesn't currently support dynamic
>> libraries. LDC
>> has the --gc-sections flag, enabled by default. This will
>> significantly reduce the since of the binary.
>
> Another option you can use today with OS X is pass in
> -dead_strip linker
> option to get rid of unreachable symbols. It works good with
> LDC.
>
> using LDC - the LLVM D compiler (0.14.0):
> based on DMD v2.065 and LLVM 3.4.2
This was supposed to be enabled by default in 0.14.0 (it is
exactly what ld --gc-sections does). Probably some issue with ld
argument wrapper for whatever lines OSX uses?
More information about the Digitalmars-d
mailing list