How can I find out what the -march
default argument is for the current architecture if I don't supply any?
Run gcc --version -v . It will output the configure invocation.
If gcc -v shows GCC was configured with a --with-arch option (or --with-arch-32 and/or --with-arch-64 ) then that's what will be the default. Without a --with-arch option (and if there isn't a custom specs file in use) then the arch used will be the default for the target.
GCC stands for “GNU Compiler Collection”. GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Fortran, Ada, D, and Go. The abbreviation GCC has multiple meanings in common use.
The GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by the GNU Project supporting various programming languages. make is a "build tool" that invokes the compiler (which could be gcc) in a particular sequence to compile multiple sources and link them together.
gcc -dumpmachine
gives you the target triplet, e.g. x86_64-unknown-linux-gnu
If gcc -v
shows GCC was configured with a --with-arch
option (or --with-arch-32
and/or --with-arch-64
) then that's what will be the default.
Without a --with-arch
option (and if there isn't a custom specs file in use) then the arch used will be the default for the target.
For x86, up to and including GCC 4.4, the default for 32-bit was -march=i386
and for 64-bit was -march=x86-64
(note the hyphen instead of underscore.)
For x86 with GCC 4.5 and later versions the default arch is inferred from the target triplet i.e. configuring for i586-pc-linux-gnu
means the default is -march=i586
, configuring for core2-pc-linux-gnu
means the default is -march=core2
.
Some other platforms also infer the default arch from the target triplet (and have done since before GCC 4.4) so e.g. ultrasparc2-sun-solaris2.10
implies -march=ultrasparc2
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With