Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default for gcc -march option?

Tags:

gcc

gcc4

gcc4.7

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.

like image 913
BehemothTheCat Avatar asked Jan 05 '15 20:01

BehemothTheCat


People also ask

What is GCC default standard?

By default, gcc does not conform to any of the ANSI/ISO C standards. The current default is equivalent to -std=gnu90 , which is the 1989/1990 standard with GNU-specific extensions. (Some diagnostics required by the language standard are not issued.)

What is the option for GCC?

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.

What is GCC output?

The default executable output of gcc is "a.out", which can be run by typing ./a.out. It is also possible to specify a name for the executable file at the command line by using the syntax -o outputfile , as shown in the following example: gcc filename -o outputfile. Again, you can run your program with "./outputfile".


1 Answers

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-

like image 179
nos Avatar answered Oct 13 '22 00:10

nos