获取当前的GCC体系结构 [英] Obtaining current GCC architecture
问题描述
如果我没有提供
How can I find out what the -march
default argument is for the current architecture if I don't supply any?
推荐答案
gcc -dumpmachine
为您提供目标三元组,例如 x86_64-unknown-linux-gnu
gcc -dumpmachine
gives you the target triplet, e.g. x86_64-unknown-linux-gnu
如果 gcc -v
显示GCC配置了 - with-arch
选项(或 - with-arch-32
和/或 - with-arch-64
)那么这就是默认设置。
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.
没有 - with-arch
选项(并且如果没有使用自定义规格文件),那么所使用的拱将作为目标的默认值。
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.
对于x86,高达并包括GCC 4.4,32位的默认值为 -march = i386
,而64位为 -march = x86-64
(注意连字符而不是下划线。)
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.)
对于使用GCC 4.5及更高版本的x86,默认拱从目标三元组推断,即配置为 i586-pc-linux-gnu
表示默认值为 -march = i586
,配置为 core2-pc-linux-gnu
表示默认值为 -march = core2
。
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
.
其他一些平台也可以从目标中推断出默认的拱形三联体(自GCC 4.4之前完成),例如 ultrasparc2-sun-solaris2.10
意味着 -march = ultrasparc2
。
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
.
这篇关于获取当前的GCC体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!