R S
R S

Reputation: 172

Is there a method to make `gcc' dump/display all the flags in use while compiling code?

Do note this is different from Get the compiler options from a compiled executable? which I did go through in detail.

Although -frecord-gcc-switches is great, it only captures the command line arguments.

For example, I am not interested in capturing -O2 which is usually passed in command line. I am more curious about recording all the flags like -fauto-inc-dec which are enabled by -O2.

(In contrast to the link above, do note that I have access to the source, the compiler and the build infrastructure. I just want to capture the flags during compilation. Not picky about any specific gcc version)

Upvotes: 5

Views: 2138

Answers (1)

Kyrill
Kyrill

Reputation: 3829

You can try -fverbose-asm. That dumps the optimisation options used in a comment at the top of the assembly file.

Upvotes: 3

Related Questions