Assemblers

published on 04-08-2024 12:30
by By Pius

Comparison of Available Assemblers on the Linux Platform

There are about a dozen assemblers available for amd64 Linux. a detailed comparison of all of them, is the eventual goal of this page. For now I will settle for the two most popular. As well as go over one tempting option for seasoned ASM programmers.

The Gnu Assembler (gas)

This is included with gnu binutils, as the target output format for both the GCC compiler, and LLVM. Its principal advantage is that it will almost never not be available. And is guaranteed to produce correct elf objects, that can be linked. Because the linker is also maintained by the same project.

The principal disadvantage of the gnu assembler is that it uses a variant of bell labs syntax. Which is is often the reverse of intel syntax, in which most examples and practical code are written.

Gas also changes instruction mnemonics to suit its own purposes, which can be a pain when looking things up in reference manuals. On the other hand it is the disassembly format for popular reverse engineering tools, and is used in the kernels of most unix operating systems today.

JWASM/USAM

Jwasm and UASM, are macro assemblers compatible with Microsoft assembler Version 6.1 syntax. They are attempting option for those who have coded in assembly language on Microsoft operating systems before. I would urge the reader to switch to another assembler as quickly as possible however, because neither of these assemblers are capable of outputting proper debug symbols. Which you need for use in the debugger. In addition the linker apparently does not like certain objects produced by these assemblers. If you’re statically linking you should be fine, but dynamic linking is another matter.

My early prototype of this project, used Jwasm as its base. And some examples might still use it. But you’re better of switching to an assembler with more mainstream support on Linux.

NASM is the best known macro assembler available for Linux. There is plenty of documentation and code samples available which use it, it can produce proper debug symbol output. And the linker doesn’t barf when dynamically linking against libraries.

YASM Has all these features, also understands gas syntax. It was a fork of NASM originally. I personally use NASM. But either assembler should get the job done.

flat Assembler

Not tried it, can’t say much about it other than most of their examples use 32bit linux abi.