AT& T语法是否在intel平台上工作? [英] Does AT&T syntax work on intel platform?

查看:295
本文介绍了AT& T语法是否在intel平台上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道gcc支持& t语法,但我希望我的程序可以在intel处理器上运行。



无论语法如何,它都可以在intel处理器上运行,或者它必须是英特尔语法才能在intel平台上运行!我很困惑??



谢谢。

解决方案

att vs intel语法已被多次覆盖,在这里和其他地方。

汇编语言是由汇编程序定义的语言,汇编语言是用于将ASCII汇编语言转换为机器的特定程序代码你感兴趣的特定目标。与说C或C ++编译器,其中有一个标准定义语言,你可以有7个汇编程序为同一个目标处理器,没有理由认为汇编语言不得不以任何形式或形式兼容。机器代码是产品的重要组成部分,如果机器代码与相同的目标匹配,那么无论出于何种原因,最好使用您最喜欢的工具。



对于这种情况,由intel文档定义并由intel汇编程序支持的intel格式。然后由其他汇编程序支持。这些指令相近或相同,他们可能有兼容模式,也许他们有自己的指令。例如as86(或者asm86或者a86?)tasm,masm和nasm。然后你有这个AT& T语法,有人在某个地方(ATT?)决定用一个愚蠢的汇编语言来编译一个汇编程序,这个汇编语言完全不符合intel文档。这成为了Intel与AT& T语法的东西。 gnu汇编器也因为混淆了现有的汇编语言而出名,他们显然使用AT& T来引入它们自己的细微差别。他们可能有一个intel语法开关,你应该检查。



您应该问的问题是目标,像x86的gnu汇编程序这样的汇编程序通常能够为各种类型的x86生成代码,因此您需要确保它与您的计算机匹配(最有可能的是,如果您不添加任何目标类型/特定选项)。



没有理由认为AT& T语法汇编程序(gnu汇编程序(gas或as))不起作用。

I'm learning assembly.

I know that gcc supports at&t syntax but i want my program to run on intel processors.

So would it work on intel processors regardless the syntax or it must be intel syntax to work on intel platform!! i'm confused??

Thanks.

解决方案

att vs intel syntax has been covered many times, here and other places.

Assembly language is a language defined by the assembler, the particular program used to convert the ASCII assembly language into machine code for the particular target you are interested in. Unlike say a C or C++ compiler where there is a standard that defines the language, you can have 7 assemblers for the same target processor and there is no reason to assume that the assembly languages have to be compatible in any way shape or form. It is the machine code the produce that matters and if that machine code matches the same target then use the tool you like the best for whatever reason.

For this case there was the intel format as defined by the intel documentation and supported by the intel assembler. And then supported sorta by other assemblers. The instructions were close or the same they might have had a compatibility mode and maybe they had their own directives. For example as86 (or was it asm86 or a86?) tasm, masm, and currently nasm. And then you had this AT&T syntax, someone somewhere (ATT?) decided to make an assembler with a goofy assembly language that specifically didnt match the intel documentation at all. And that became the Intel vs AT&T syntax thing. gnu assembler is well known for messing up existing assembly languages as well, and they apparently use AT&T with their own nuances thrown in. they might have an intel syntax switch you should check.

The question you should be asking is the target, and assemblers like gnu assembler for x86 are often capable of generating code for various flavors of x86, so you need to make sure it matches your computer (most likely does if you dont add any target type/specific options).

There is no reason to assume an AT&T syntax assembler (gnu assembler (gas or as)) would not work.

这篇关于AT& T语法是否在intel平台上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆