Generated binary size

Dicebot public at dicebot.lv
Fri Sep 13 05:02:46 PDT 2013


On Friday, 13 September 2013 at 11:58:53 UTC, Joseph Rushton 
Wakeling wrote:
> On 13/09/13 13:45, Dicebot wrote:
>> I was experimenting with `--gc-sections` effect on D code 
>> (with great results)
>
> Can you expand on this?  Never heard of it before and can't 
> find it in gdc --help or manpages.

`--gc-sections` is ld flag that enabled garbage collection of 
unreferenced sections in resulting binary. For it to work gcc/gdc 
need to be run with `-fdata-sections`and `-ffunction-sections` 
placing each symbol into own section. That will, for example, 
remove template function bodies that got inlined for all calls. 
For template-heavy code with good inliner it can reduce binary 
sizes tremendously (running it on snippet from this topic will 
reduce gdc binary size to almost match dmd one).


More information about the D.gnu mailing list