Changing .dynstr to be more C++ friendly?

Chris Kirby ckirby@laurelnetworks.com
Thu Feb 24 01:11:00 GMT 2005


We have a large C++ embedded project where we have some large (~7MB) .dynstr sections that are taking up a lot of memory.  I used objdump to dump out all of the dynamic strings, and I noticed two C++ features that contributed to the large string size:
1) namespaces and class names are at the front of the mangled symbol name
2) templates with multiple instantiations

Looking at the strings, I noticed that there are possibilities for compression:
- For functions in the same namespace / class (#1), they tended to have a common prefix.
- For instantiated templates (#2), they tended to end with the same suffix since they implement similar functions.

My thinking was that we could change the definition of an Elf symbol to not contain a single name, but rather N distinct name components (3 in this case).  Using the example above, we could use the first for the prefix, the second for the unique portion, and the third for the suffix.  The hope would be that the prefix and suffix strings would be shared across multiple symbols.

For C++ applications I think the compression possible would be fairly high.  How difficult do you think it would it be to add these additional strings to the elf symbol table entries?

- Chris Kirby 



More information about the Binutils mailing list