[Bug c++/43601] Enormous increase in DLL object files size in 4.5
LpSolit at netscape dot net
gcc-bugzilla@gcc.gnu.org
Tue Sep 28 11:55:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601
--- Comment #30 from Cesar Strauss <cestrauss at gmail dot com> 2010-09-27 02:00:39 UTC ---
(In reply to comment #29)
Dear Vadim
> The difference in number of sections seems to correspond to the fact that 4.5
> now generates one section per method of any exported class used by the object
> file instead of just one section per class as in 4.4.
Sorry, but I do not completely agree with this assessment. If you run
objdump -h <object> | c++filt
you will see that 4.4 still generates one section per method, not per class
(the name of the method is reveled by c++filt).
In my view, the difference is only that 4.5 emits a section for every inline
method of every dllexported class in sight. 4.4 only emitted those which the
code actually needed.
Why there is one section for each emitted inline method? As I understand it,
since the same inline method can be exported by multiple object files, there
would be a danger of having multiple definitions at link time. To avoid this,
they reside in separate sections marked as LINK_ONCE_DISCARD, so the linker can
discard these multiple copies and keep just the first one encountered.
To avoid all these copies in the first place, the idea from Yu Simin in comment
#26 seems to be a good one.
Regards,
Cesar
More information about the Gcc-bugs
mailing list