Is there any way to read from compiled code what CCFLAGS (particularly the optimizations) were set at compile time?

  • I think your question is a duplicate of stackoverflow.com/questions/2387040/… but given it's on a different SE site I can't report it through the "flag" button.
    – Shadok
    Feb 21, 2013 at 13:49
  • @Shadok almost what he wants: your link refers to reading the GCC version, the asker wants to know if he can find the CFLAGS used for building the binary.
    – Renan
    Feb 21, 2013 at 13:57
  • 1
    Sorry I think I swapped two links, here the one I wanted to link: stackoverflow.com/questions/189350/…
    – Shadok
    Feb 21, 2013 at 14:16
  • 1
    Thanks Shadok - if you add this as an answer I'll accept it. In my case the code was compiled with gcc 4.5 :) but the binary in question has been stripped :(
    – symcbean
    Feb 21, 2013 at 22:56

1 Answer 1


Apparently there is but only with gcc >= 4.3,the switch -frecord-gcc-switches causes the whole command line to be put into ASCII commentaries.

See here for an answer to this question on SO.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .