This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Changing .dynstr to be more C++ friendly?
- From: Chris Kirby <ckirby at laurelnetworks dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 23 Feb 2005 14:22:50 -0500
- Subject: Changing .dynstr to be more C++ friendly?
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