Generated binary size

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Fri Sep 13 06:36:32 PDT 2013


On 13/09/13 15:25, Dicebot wrote:
> On Friday, 13 September 2013 at 13:14:49 UTC, Joseph Rushton Wakeling wrote:
>> Related query -- is there any way of telling the compiler (gdc/gdmd or
>> preferably any of the D compilers) to strip out unused symbols/functions/data
>> from the binary?
>>
>> I have a module that includes a quite large array of immutable data (used for
>> test purposes), but when this is compiled in with other code it adds about
>> 10MB (!) to the executable size, even when the executable never uses it.
>
> It is exactly what `gdc -fdata-sections -Xlinker --gc-sections app.d` will do.

Tried it.  It reduces 12 MB executables to 11 MB -- but if I manually exclude 
the module responsible for the big data, executable sizes fall to 2 MB.


More information about the D.gnu mailing list