Binary Size: function-sections, data-sections, etc.

Trass3r un at known.com
Wed Dec 21 12:38:39 PST 2011


On Wednesday, 21 December 2011 at 19:04:21 UTC, Artur Skawina 
wrote:
> gc'ed sections, i notice ld does claim to have removed eg
> ".text._D11gcfuncdata218_sharedStaticCtor3FZv", which is one of 
> the ctors.
> The reason things still work is because the code is also 
> inlined in "_D11gcfuncdata215__modsharedctorFZv" together with 
> the other ctor. Aha, the compiler (gdc) actually inlined all 
> the [cd]tors when run at -O3,
> and the "real" constructor was then garbage collected by the 
> linker. Phew.
> Compiling with -O2 makes modsharedctor call all the ctors 
> instead, and they are then not gc'ed.
>
> Why the compiler emits the unused outofline ctors is another 
> question.
> Maybe i should start marking them as private?...

Maybe they should be marked by the compiler as private by default?


More information about the Digitalmars-d mailing list