help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q1: function-level linking is not working as expected


From: Michael Kilburn
Subject: Re: Q1: function-level linking is not working as expected
Date: 26 Apr 2007 03:07:17 -0700
User-agent: G2/1.0

On Apr 25, 3:32 pm, Paul Pluzhnikov <ppluzhnikov-...@charter.net>
wrote:
> Michael Kilburn <crusader.m...@gmail.com> writes:
> > And indeed executable size was decreased to ~32Mb. But still it is
> > wrong -- I have created simple application that just calls empty
> > function from one of these libraries:
> > int main()
> > {
> >     foo(); // foo's body is empty
> > }
>
> > resulting image size was ~17Mb. If you comment out this call image
> > size = 5kb.
>
> If the file that was pulled in (the one defining empty foo()),
> contains any global objects, then the constructors for such objects
> are pulled in, anything that these constructors reference is pulled
> in, etc. etc.

I thought about it... Yes, there are quite a few static object with
non-trivial contructor/destructor. But, I thought that specifying
-ffunction-sections
-fdata-sections
is equivalent of putting every function and static variable in a
separate translation unit/object file. In this case, since foo() does
not reference anything -- the rest should be thrown away.
There is another suggestion -- maybe referencing something from static
library (*.a) brings in all static variables (and their dependencies),
but even then they should be thrown away -- simply because their trees
of references are isolated from our stuff (references tree derived
from entry-point function). :-(

Bye.
Sincerely yours, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]