Post

Compiling sources with different optimization flags with GCC

I had some strange problems with some GCC bugs with AntSnes and gpsp. For some reason some source files did not compile correctly with “-O2” optimization flags. A quick way to fix this problem was to compile the objects with problems without optimizations.

My quick “hacky” solution was to compile these few files with “-O0” flags into the asm-files from command line, and then include these asm-files from the mmp/makefile into the project.

Compiling the sources into asm-listings can be done like this:

1
 gcc -O0 -S -c foo.c

Of course you’ll get some problems from missing included etc, but that can be solved by adding all the include folders to the gcc with “-include” flag.

This post is licensed under CC BY 4.0 by the author.