What is the default for gcc -march option?

BehemothTheCat picture BehemothTheCat · Jan 5, 2015 · Viewed 7.2k times · Source

The gcc info file says in the section on x86-64 specific flags, among other things:

      There is no `-march=generic' option because `-march'
      indicates the instruction set the compiler can use, and there
      is no generic instruction set applicable to all processors.
      In contrast, `-mtune' indicates the processor (or, in this
      case, collection of processors) for which the code is
      optimized.

My question then is, what instruction (sub-)set does gcc compile for when no -march option is given? There is a lot of related information about -march and -mtune in the webosphere, but none that I could find which answers this simple question. It can't be march=native, or else it would be impossible to compile generic distribution kernels and binary packages.

Answer

nos picture nos · Jan 5, 2015

The default flags for gcc can be set when gcc itself is compiled. Run:

  gcc -Q --help=target 

to see what the default is on your machine. Likely it'll just be x86-64 even though the man page doesn't document that as a value for -march-