首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >nasm:错误:16位模式不支持指令

nasm:错误:16位模式不支持指令
EN

Stack Overflow用户
提问于 2019-02-24 06:49:34
回答 1查看 3.1K关注 0票数 0

我正在遵循这个例子。但是我得到了这个错误。有人知道如何解决这个问题吗?我在Mac OS X 10.14.1上运行。

代码语言:javascript
复制
$ nasm -o hello_world.o hello_world.asm
hello_world.asm:8: error: instruction not supported in 16-bit mode
hello_world.asm:9: error: instruction not supported in 16-bit mode
hello_world.asm:10: error: instruction not supported in 16-bit mode
hello_world.asm:11: error: instruction not supported in 16-bit mode
hello_world.asm:15: error: instruction not supported in 16-bit mode
hello_world.asm:16: error: instruction not supported in 16-bit mode
$ nasm --version
NASM version 2.13.03 compiled on Feb  8 2018

How does C++ linking work in practice?

代码语言:javascript
复制
section .data
hello_world db "Hello world!", 10
section .text
global _start
_start:

; sys_write
mov rax, 1
mov rdi, 1
mov rsi, hello_world
mov rdx, 13
syscall

; sys_exit
mov rax, 60
mov rdi, 0
syscall
EN

回答 1

Stack Overflow用户

发布于 2019-06-07 07:11:08

问题不在代码中。

要编译的完整命令是nasm -f elf64 -o hello.o hello.asm

您必须使用-f选项指定nasm编译器的格式(elf64)。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54847041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档