【发布时间】:2016-03-16 11:16:06
【问题描述】:
根据一些文档和this answer,可以在 Linux 中使用英特尔语法而不是默认的 AT&T 语法来使用 GAS。
我尝试编译以下简单代码,包含在专用文件file.s中:
.intel_syntax noprefix
section .data
section .text
global _start
_start:
mov eax, 1 # some random comments
mov ebx, 0
int 80h
如果我运行as file.s -o file.o,则会产生以下错误:
is2_exit.s: Assembler messages:
is2_exit.s:3: Error: no such instruction: `section .data'
is2_exit.s:5: Error: no such instruction: `section .text'
is2_exit.s:6: Error: no such instruction: `global _start'
is2_exit.s:13: Error: junk `h' after expression
似乎根本没有考虑.intel_syntax。怎么了?
【问题讨论】:
-
如果你使用
.data、.text、.global _start和0x80怎么样? -
intel_syntax不适用于指令,尤其是因为没有单一的 intel 语法。它们在每个汇编器中都不同。 -
@Michael 是的,你是对的!如果你想写答案,我会选择它。
-
@Jester 我不知道。通过更改指令语法,它实际上不会出错。
标签: linux assembly compiler-errors intel att