Obtaining current GCC architecture

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)