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.
Solved! Go to Solution.
Hello
Did you look at linker option -Cocc?
This one seems to be doing what you are trying to achieve.
CrasyCat
Hello,
I don't quite understand your dependency argument with respect to "unrelated functions". I might assume a globally defined const char array, to be accessible to any function that required its use.
Regards,
Mac
Hello
Did you look at linker option -Cocc?
This one seems to be doing what you are trying to achieve.
CrasyCat
That's exactly what I needed. I guess I overlooked that option when I was looking at the linker options.
Thanks!
Additional info: HC08, CodeWarrior 5.9.0