Skip to content

Intel vs. AT&T Syntax

Rahul Sridhar edited this page Oct 18, 2017 · 1 revision

Confusingly, there are two distinct flavors of syntax for x86-64 assembly, AT&T and Intel. Even more confusingly, the world can't seem to agree on which one is better, and more confusingly still, the two syntaxes switch the order of operands for most instructions. At TechSec, we try to stick to Intel for all our workshops, code snippets, and tools.

This page outlines most of the differences pretty well. All you really need to know is that if you see a bunch of $'s and %'s in your assembly output, you're reading AT&T syntax. Below we'll show you how to configure all the tools we use to output Intel.

objdump

On Linux: objdump -M intel On OS X: objdump -x86-asm-syntax=intel

We recommend making this an alias so that you don't have to type it out every time. In your ~/.bash_profile add the line:

alias objdump='objdump -M intel'

or

alias objdump="objdump -x86-asm-syntax intel"

for OS X.

gdb

In your ~/.gdbinit file (make one if you don't have one), include the line

set disassembly-flavor intel

IDA Pro / Binary Ninja

Both IDA Pro and Binary Ninja use Intel by default. Yay!

Clone this wiki locally