You are not logged in.
How can one get gcc to show all of the C(XX)FLAGS it is using on a build including ones that are autoset or set as a defaults by virtue of another switch?
Last edited by graysky (2018-03-16 19:32:28)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
You likely want to check the -Q and --help=* flags, e.g.:
gcc -Q --help=optimizers
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
What is your goal here? Are you trying to debug a build? Do you want to show this in the buildsystem progress? Do you want to inspect the contents of a binary and find out what options it was built with?
You can always use -v which will tell you, well, way too much information. Or -###
Either one shows you the COLLECT_GCC_OPTIONS as well as the actual cc1 command line that would be generated and the ./configure command line used to build your gcc compiler.
See the Gentoo wiki discussion around choosing compiler flags (and knowing which ones you are already using): https://wiki.gentoo.org/wiki/GCC_optimization#-march
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Thanks for the replies and links, guys. My goal is to simple see (prove they have been called) any options that are activated by compiling with -march=haswell in /etc/makepkg.conf leaving the other default CFLAGS in place.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Oh, well that's a much more specific question:
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks again, guys. This is what I wanted to see.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
What is your goal here? Are you trying to debug a build? Do you want to show this in the buildsystem progress? Do you want to inspect the contents of a binary and find out what options it was built with?
Actually... I can answer 'yes' to two of these questions:
1) Do you want to show this in the buildsystem progress? I believe the answer is to add the -v switch at build time, yes?
2) Do you want to inspect the contents of a binary and find out what options it was built with? Yes, that would be cool to see as well.
Thanks.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Eschwartz wrote:What is your goal here? Are you trying to debug a build? Do you want to show this in the buildsystem progress? Do you want to inspect the contents of a binary and find out what options it was built with?
Actually... I can answer 'yes' to two of these questions:
1) Do you want to show this in the buildsystem progress? I believe the answer is to add the -v switch at build time, yes?
2) Do you want to inspect the contents of a binary and find out what options it was built with? Yes, that would be cool to see as well.Thanks.
Well, ideally the build system will already verbosely print the command line it is executing. This doesn't show the options that gcc was configured to enable by default, of course. So -v would do that, at least by virtue of printing the configure line from the gcc PKGBUILD itself... but that would take some parsing. It does also show you the resolved FLAGS for -march=native so that's good.
Again, that is rather more verbose than most people will want and anyways this is probably best picked up from the environment CFLAGS rather than the project Makefile.
As for inspecting the contents of a binary, we (Arch Linux) want that too at least for packages. This would have the advantage of enhancing Reproducible Builds efforts, as well as allowing us to confirm that packages are actually being properly built with out makepkg.conf *FLAGS
You can use -frecord-gcc-switches for this. You can also enable debugging, as this should turn on -grecord-gcc-switches by default.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline