8

我试图运行的代码如下。我使用 nasm util 将其转换为目标文件。当我尝试执行时,它说“无法执行二进制文件”。

我运行命令:nasm -f elf -o helloworld.o helloworld.asm

segment .data
msg  db   "Hello, world!",10
len  equ  $ - msg

segment .text
global _start

_start:
   mov  eax,4
   mov  ebx,1
   mov  ecx,msg
   mov  edx,len
   int  80h

   mov  eax,1
   mov  ebx,0
   int  80h


这是我在汇编中的第一个程序,除了编译一些基本的 c 程序外,我没有使用 ubuntu 。我需要一些帮助谢谢大家。

4

1 回答 1

10

它非常适合我的代码。

您是否链接了最终的目标文件?

试试这个:ld helloworld.o -o helloworld

于 2010-10-11T20:54:10.597 回答