Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
    
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 '13 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 '13 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 '13 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 '13 at 22:56
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.