我一直在尝试在Linux上学习x86 Assembly,这是我的代码:
.386
.model flat
.code
start PROC
mov eax, 100
add eax, 200
ret
start endp
end start
每当我尝试使用nasm进行编译时,就像这样:
nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.o
我收到此错误:
simple.asm:1: warning: label alone on a line without a colon might be in error [-w+orphan-labels]
simple.asm:1: error: attempt to define a local label before any non-local labels
simple.asm:2: error: attempt to define a local label before any non-local labels
simple.asm:2: error: parser: instruction expected
simple.asm:3: warning: label alone on a line without a colon might be in error [-w+orphan-labels]
simple.asm:3: error: attempt to define a local label before any non-local labels
simple.asm:4: error: parser: instruction expected
simple.asm:9: error: symbol `start' redefined
simple.asm:9: error: parser: instruction expected
simple.asm:10: error: parser: instruction expected
为什么会出现该错误?是编译器还是代码?以及如何解决?