Removing comments from source code changes *.o, *.map, *.axf files

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.

Parents
  • 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.

Reply
  • 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.

Children
More questions in this forum