获取当前的GCC体系结构

编程入门 行业动态 更新时间:2024-10-25 18:34:35
本文介绍了获取当前的GCC体系结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我没有提供

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体系结构

本文发布于:2023-11-12 01:48:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580167.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:体系结构   GCC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!