We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Compiling for STM32F103CB using Keil MDK-ARM v4.10
This is proving to be a major pain this afternoon, but we have discovered a crazy bug in the Keil compiler.
If we remove some comments (e.g. "//This is a comment") from a file within the source code then we see differences in the .map files, the .o object files and also the .axf file.
This seems to get worse if I change the optimization settings from -o0 to -03.
Any chance that the tool is actually at fault here, or am I going mad?
Many thanks,
Stephen Ormston.
Well, *.o files contain debugging information which could be sensitive to source code changes (I don't know this for a fact, pure speculation.) Same about *.axf. Not sure about *.map files. Also you should not forget about the linker->compiler feedback mechanism for elimination of unused functions. This mechanism can lead to different program images in consecutive builds. It should stabilize after second consecutive build, though.
It is a fact - object files do contain debug information.
Also, if your code makes any use of anything like __LINE__ then that will obviously be affected by adding/removing comments...
Thanks for the comments everyone - it does seem to be only the debug information that changes, but I was surprised that even this had to change simply because a comment had been removed.
Saying that, I suppose if the line containing the comment has been removed then debug info would need to be updated to account for the change in line numbers for the remaining code.
Thanks again,
SteveO.
Yes, that's it!
This is probably as good a place as any to mention that you can use something like
fromelf --compare --ignore_section=".debug_*" obj1.o obj2.o
to compare two object files while ignoring the debug info.