I have a C ++ library that generates much larger code that I would really expect from what it does. From less than 50 thousand source lines, I get shared objects that are almost 4 MB, and static archives by pressing 9. This is problematic because the binary binaries of the library are quite large, and, even worse, even simple applications connecting it, usually get from 500 to 1000 KB in code size. Compiling a library with flags such as -Os helps with this, but not much.
I also experimented with the GCC -frepo team (although all the documentation I saw assumes that Linux collect2 will combine duplicate templates anyway) and explicitly creating a template on templates that seem to “probably” duplicate a lot, but without real effect anyway. Of course, I say “sooner” because, as with any profiling, blind guessing like this is almost always wrong.
Is there any tool that makes it easier to determine the size of the code, or in some other way I can figure out what takes up so much space or, more generally, any other things that I should try? Something that works under Linux would be ideal, but I will take what I can get.
c ++ gcc linux code-size
Jack Lloyd Oct 13 '09 at 17:09 2009-10-13 17:09
source share