以什么程序集为目标
What assembly to target
我对汇编有点困惑。像 GCC 这样的编译器以什么样的程序集为目标,它如何确定要生成什么程序集?这些类型的组件有多少不同,是巨大的差异,还是不那么明显?今天有多少种装配被广泛使用?
What kind of assembly does a compiler like GCC target, and how does it
figure out what assembly to generate?
每个 CPU 系列( 体系结构 )都有不同的程序集,并且构建 GCC 以支持其中许多 CPU 系列。您可以向 GCC 传递一个参数以指示您要定位哪个架构(如果您正在编译的架构与您正在编译的架构不同,则称为 cross-compiling)。
How much do these types of assembly differ, is it a huge difference,
or not as noticeable?
通常每个体系结构都完全不同并且与其他体系结构绝对不兼容。
How many types of assembly are widely used today?
太多无法在此处列出,但当今使用最广泛的架构是用于 PC 的 Intel x86 和 x86-64,用于 mobile/embedded 设备的 ARM(在较小程度上,MIPS)。更简单和更小的设备可以使用微控制器而不是全功能的 CPUs.
So all the modern intel processors, do they change their language
thing often or rarely?
视情况而定。通常制造商会尝试保持与旧型号的兼容性,尽管他们也可以决定打破它(即 Intel's IA-64 架构)。
And is that why some binary files have something-i386 etc prefixed, is
that the kind of processor set/type/thing it supports?
是的。叫做"architecture".
我对汇编有点困惑。像 GCC 这样的编译器以什么样的程序集为目标,它如何确定要生成什么程序集?这些类型的组件有多少不同,是巨大的差异,还是不那么明显?今天有多少种装配被广泛使用?
What kind of assembly does a compiler like GCC target, and how does it figure out what assembly to generate?
每个 CPU 系列( 体系结构 )都有不同的程序集,并且构建 GCC 以支持其中许多 CPU 系列。您可以向 GCC 传递一个参数以指示您要定位哪个架构(如果您正在编译的架构与您正在编译的架构不同,则称为 cross-compiling)。
How much do these types of assembly differ, is it a huge difference, or not as noticeable?
通常每个体系结构都完全不同并且与其他体系结构绝对不兼容。
How many types of assembly are widely used today?
太多无法在此处列出,但当今使用最广泛的架构是用于 PC 的 Intel x86 和 x86-64,用于 mobile/embedded 设备的 ARM(在较小程度上,MIPS)。更简单和更小的设备可以使用微控制器而不是全功能的 CPUs.
So all the modern intel processors, do they change their language thing often or rarely?
视情况而定。通常制造商会尝试保持与旧型号的兼容性,尽管他们也可以决定打破它(即 Intel's IA-64 架构)。
And is that why some binary files have something-i386 etc prefixed, is that the kind of processor set/type/thing it supports?
是的。叫做"architecture".