Ubuntu18.04下Intel汇编编译器nasm用法介绍

nasm编译器

NASM Command−Line Syntax
To assemble a file, you issue a command of the form

nasm −f <format> <filename> [−o <output>]

For example,

nasm -f elf myfile.asm

will assemble myfile.asm into an ELF object file myfile.o. And

nasm -f bin myfile.asm -o myfile.com

will assemble myfile.asm into a raw binary file myfile.com.
To produce a listing file, with the hex codes output from NASM displayed on the left of the original
sources, use the -l option to give a listing file name, for example:

nasm -f coff myfile.asm -l myfile.lst

To get further usage instructions from NASM, try typing

nasm -h

The option --help is an alias for the −h option.
The option -hf will also list the available output file formats, and what they are.
If you use Linux but aren’t sure whether your system is a.out or ELF, type

file nasm

(in the directory in which you put the NASM binary when you installed it). If it says something like
nasm: ELF 32−bit LSB executable i386 (386 and up) Version 1
then your system is ELF, and you should use the option −f elf when you want NASM to produce
Linux object files. If it says
nasm: Linux/i386 demand−paged executable (QMAGIC)
or something similar, your system is a.out, and you should use −f aout instead (Linux a.out
systems have long been obsolete, and are rare these days.)
Like Unix compilers and assemblers, NASM is silent unless it goes wrong: you won’t see any output at
all, unless it gives error messages.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值