On Thursday, 12 September 2013 at 13:58:03 UTC, H. S. Teoh wrote:
Interesting. However, I ran into some runtime segfaults caused by --gc-sections yesterday. I didn't investigate further, but that makes me hesitant to make --gc-sections the default. Something, somewhere, is being broken by --gc-sections. It doesn't happen in all cases, though.
Only some of my programs are affected by it.

I should investigate this when I get some time.

Actually, nevermind, dmd only does it for small portion of the code :) However, I have tested -ffunction-sections + -fdata-sections + --gc-sections on gdc and have reduced binary size _twice_ for a simple `writeln(arr.map(a => a*2)())` snippet. Which is only partially cool because gdc binary is more than twice larger than dmd one for same code :D

Problem with --gc-sections is that it can't be used when building libraries and any with executable that expose parts of own code to shared libraries. It is essentially a whole program optimization and it can't be done without compiler support in cases where binary is _not_ the whole program.

Reply via email to