I was trying to track down why my executable became slower after a certain date. And I suspected that -O3 was dropped in the new build process at work. That's why I am trying to find a way to narrow down the issue. ----- Original Message ----- From: Ángel González <keisial@xxxxxxxxx> To: vijay nag <vijunag@xxxxxxxxx> Cc: Hei Chan <structurechart@xxxxxxxxx>; GCC-help <gcc-help@xxxxxxxxxxx> Sent: Wednesday, August 7, 2013 9:14 PM Subject: Re: -O3 Enabled? On 07/08/13 06:58, vijay nag wrote: > If you just have the binary without the source, I guess it is > impossible to figure out optimization level. > > If you have source for the same, you can build it with -O0, > disassemble the code and compare the compiler code emission for a > particular > function. > > In future, if you would like to know the CFLAGS with which it was > built, you can export those information to a header as #define's and > be included > in one of compilation units. > > Vijay Nag Depending on the compiler/platform/format you could get some hints. For instance -fomit-frame-pointer would be easy to detect in disassembly. But it would be a hard and mostly-manual work (and you would probably need quite a bit of knowledge about gcc phases). I don't think it's worth trying to figure out. Do you have a real need for knowing that?