Executable size affected by module count?

Sean Kelly sean at f4.ca
Wed Jan 24 14:31:25 PST 2007


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> kris schrieb am 2007-01-24:
>> Given a (fixed) body of code, it appears that retaining it all within 
>> one module, and splitting it into multiple modules, results in different 
>> executable sizes?
>>
>> There's no real surprise that this would happen, but it's the actual 
>> difference that is cause for a little concern -- it appears that each 
>> module consumes 512 bytes minimum. This may actually be a linker thing, 
>> but perhaps not?
> [...]
>> Any ideas, Walter?
> 
> Every non-trivial module contains (numbers are for Linux)
> _D5module7__arrayZ
> 23 bytes code, 19 bytes stringtab, 18 bytes symtab
> 
> _D5module8__assertFiZv
> 24 bytes code, 23 bytes stringtab, 18 bytes symtab

These are the outstanding problem for exposing templates from library 
code.  And I don't understand why they are generated, since it seems 
like the code will be identical for each instance generated.  Couldn't 
they just have a static definition in the runtime?

> _D5module9__modctorFZv
> 11+ bytes code, 23 bytes stringtab, 18 bytes symtab

Only if the module as a static ctor though, right?

> In total 177 bytes, after stripping (strip --strip-all) 58 bytes.
> The minimum overhead of an object file is about 800 bytes,
> most of those are discared at link time.

Thanks for the info.


Sean



More information about the Digitalmars-d mailing list