On Thu, Jun 8, 2017 at 11:21 AM, Nick Clifton <ni...@redhat.com> wrote: > Hi Guys, > > The -frecord-gcc-switches option records the gcc command line. It > does not however expand options like -O2 into the optimizations that > this enables. Thus if a user wants to know if a specific optimization > was used when creating an object file, (or library or executable), > they will have to reverse engineer the compilation process. Which may > or may not be possible. > > The attached patch is a proposal to address this problem by making > -frecord-gcc-switches also record all the enabled options. This does > make object files bigger, but this cannot be helped. The enhancement > is not enabled by default however, instead a second command line > option must be used. In a possibly contentious move I chose to reuse > the -fverbose-asm option, rather than creating a new one. I did this > because a) it simplifies the patch, b) we have more than enough switch > recording options already, c) it does not conflict with the current > use of -fverbose-asm and d) it ties in nicely with the name of the > option. > > Tested, with no regressions on an x86_64-pc-linux-gnu target, and > built for a variety of other targets. > > OK to apply ?
I think individually enabled passes by -On are not really useful information as you generally cannot replace -On by a set of other switches on the command-line. Richard. > Cheers > Nick > > gcc/ChangeLog > 2017-06-08 Nick Clifton <ni...@redhat.com> > > * varasm.c (dump_enabled_to_asm_out_file): New function. Prints > enabled options to the asm_out_file. > (elf_record_gcc_switches): If verbose-asm is set then also dump > all enabled options to the asm file. > * toplec.c (print_switch_values): Convert from static to global. > * doc/invoke.texi (-fverbose-asm): Mention its effect on the > -frecord-gcc-switches option. > (-frecord-gcc-switches): Refactor the description and add details > of how -fverbose-asm modifies its behaviour. >