AnsweredAssumed Answered

Duplicate string literals in final binary -- compiler optimization to "Reuse Strings"?

Question asked by Tom Collins on Aug 12, 2010
Latest reply on Aug 13, 2010 by Tom Collins

Browsing through the MAP file for my project, I saw that it contained multiple copies of some string literals (in my case "0123456789abcdef", used in multiple debug locations to dump byte arrays, and even the empty string "").  I searched quite a bit for a compiler option similar to the "Reuse Strings" option for the Coldfire compiler, but to no avail.


Is there some way to get the compiler to only link one copy of the string literal into the final binary?


I understand that I can create a constant char array, but that creates a dependency from these unrelated functions that I use on other platforms.  I'm surprised that a compiler for such a resource-constrained target wouldn't consolidate string literals as much as possible.