linux - FASM 在组装过程中给了我 'error: illegal instruction.'

标签 linux assembly x86 fasm

我刚刚开始用汇编编码。我已经下载了flat assembler并从互联网上复制了代码。然而,当我运行此代码时,它会显示如下内容:

section .text 
error: illegal instruction.

我的问题是:这段代码有什么问题?

section .text
   global_start     ;must be declared for linker (ld)

_start:             ;tells linker entry point
   mov  edx,len     ;message length
   mov  ecx,msg     ;message to write
   mov  ebx,1       ;file descriptor (stdout)
   mov  eax,4       ;system call number (sys_write)
   int  0x80        ;call kernel

   mov  eax,1       ;system call number (sys_exit)
   int  0x80        ;call kernel

section .data
msg db 'Hello, world!', 0xa  ;our dear string
len equ $ - msg              ;length of our dear string

有人能弄清楚出了什么问题吗?

最佳答案

第二行少了一个空格

section .text
    global _start

参见here

关于linux - FASM 在组装过程中给了我 'error: illegal instruction.',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34006442/

相关文章:

c++ - 我可以使用 xbuild 在 Linux 上编译 Visual C++ 项目吗?

c - 汇编程序在调用 printf 后崩溃

c - _dl_sysinfo_int80 的用途是什么?

assembly - 如何在汇编中不使用div求余数

x86 - x86_64 CPU 能否在流水线的同一阶段执行两个相同的操作?

linux - Thingsboard:数据库更改

linux - 使用linux系统调用在基本TCP服务器中获取http header

linux - 构建 Xenomai 时如何修复目标 "' 的错误 "doc/automake-1.14.1' 配方失败“

assembly - 汇编jmp内存表达式

c++ - 对不同的整数宽度使用 xadd