【asm】汇编器yasm使用说明

DATE: 2018.11.21

1、汇编器yasm

项目网址:http://yasm.tortall.net/
下载:http://yasm.tortall.net/Download.html
在编译x86汇编代码时,可以使用yasm实现跨平台编译(Windows, Linux, Mac OSX)。

yasm介绍:
Yasm is a complete rewrite of the NASM assembler under the “new” BSD License (some portions are under other licenses, see COPYING for details).

Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats.

Yasm can be easily integrated into Visual Studio 2005/2008 and 2010 for assembly of NASM or GAS syntax code into Win32 or Win64 object files.

yasm继承自masm,扩展了支持语法和平台,支持Intel格式语法和GNU AS语法。

疑惑:yasm或者nasm可以进行x86 纯汇编的编译,但是支持inline assembly和Intrinsic assembly吗?

2、yasm使用说明
Running Yasm

Version Information:

yasm --version
Command Line Option Help:

yasm --help
Assemble test.asm to Win32 object file test.obj with CodeView 8.0 (VS2005) source debug info:

yasm -f win32 -g cv8 test.asm
Assemble test2.asm to Win64 object file test.obj with CodeView 8.0 source debug info:

yasm -f win64 -g cv8 test2.asm
Assemble test3.asm to AMD64 ELF object file test3.o with DWARF2 debugging information:

yasm -f elf64 -g dwarf2 test3.asm
Alternative to above:

yasm -f elf -m amd64 -g dwarf2 test3.asm
Assemble test4.s (GAS syntax file) to 32-bit x86 ELF object file testo.o with DWARF2 debugging information:

yasm -p gas -f elf32 -g dwarf2 -o testo.o test4.s

yasm -i %(RootDir)%(Directory)\ -f win32 -o $(IntDir)%(Filename).obj %(FullPath)
yasm -i %(RootDir)%(Directory)\ -f win64 -o $(IntDir)%(Filename).obj %(FullPath)

yasm -f maco32 test.asm
yasm -f maco64 test.asm

yasm的使用详细参考文档:http://www.tortall.net/projects/yasm/manual/manual.pdf

3、安装配置方法
./configure
make
make install

prefix的作用
profile
.bash_profile


THE END!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞翔的鲲

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值