yasm vs nasm differences
Peter Johnson
peter at tortall.net
Mon Dec 3 21:42:11 PST 2007
On Mon, 3 Dec 2007, Mike Frysinger wrote:
> is there a section that does an outline of places where yasm/nasm differ ? i
> think such a thing would be quite handy ... we've been trying to get all
> packages in Gentoo working with yasm rather than nasm ...
Unfortunately there's not really a unified list. I should probably work
on one; I'll try to put together an initial list in this email.
Generally we try to be compatible except where there's a compelling reason
to be different (such as with %include file handling).
There's a note of %include being C-compiler-like in the most recent
release notes and its behavior is more precisely described in the Yasm
manual.
There's a few 64-bit differences, as Yasm had support first and I don't
want to break backwards compatibility with older Yasm programs. The
differences are detailed in a few different places in the Yasm manual and
in one place on the "AMD64" wiki page.
You've already run across the preprocessor not handling relocatable
expressions in %if. We're working on trying to handle the simpler cases,
but Yasm will probably never handle everything NASM does in this area due
to its different internal structure. By and large it's possible to do
most of these differently.
Yasm doesn't need a -O option (although it accepts it for compatibility
purposes); it always generates the most optimal code possible.
Yasm handles ALIGN more intelligently; when executed in a known code
section, it fills not with 0x90 (one-byte NOP) but with more efficient
multi-byte NOPs where possible. It also automatically adjusts section
alignment to the largest ALIGN value. ALIGNB operates the same way as
in NASM. This is documented in the Yasm manual (section 3.8.6).
Yasm has a number of features NASM doesn't have, such as structured
exception handling support for Win64 targets, more extensive CPU directive
options, and DWARF debugging support.
Hope this helps, and thanks for all the bug reports! We're already
working on fixing most of them.
Peter
More information about the yasm-devel
mailing list