-pg And -o3 Conflicting In Gcc?


A_SN

Active Member
Joined
Jun 8, 2006
Messages
899
I'm using arm-linux-gcc 4.0.2 from DJWillis' Open2x toolchain to compile my GP2X apps, and I noticed that when I compile my apps with either -O3 or -pg (the gprof option, to generate profiling), everything works fine, but when I compile with both -pg and -O3, I often get a segmentation fault. Same with -O2 or -O1 instead (and obviously not -O0).

Worst is that debugging the resulting binary with gdb reveals that the segmentation fault takes place in function mcount(), which is -pg's profiling function.

So, what's up with that? Did anyone experience that? And I need to be able to profile when I have -O3 enabled, so what can I do?

Edit : I forgot to precise that I also use the following arguments : -static -lSDL -lpthread -lpng -lz -lm
 
I just tried to get rid of SDL and by taking off -lSDL. Now -O3 and -pg work well together again.

So, it's a SDL related issue..

Edit : no, wait, it does it too without SDL...
 
Back
Top