Giving up on AT&T style assembler syntax
Until recently I had been pretty agnostic about Intel vs. AT&T style assembler syntax. I always noticed that people who had a strong opinion almost always preferred Intel-style, but I didn’t care too much one way or the other.
gcc was my first real compiler, and this was back before binutils supported Intel syntax like they do now. So I read Brennan’s Guide to Inline Assembly which uses AT&T syntax, made that my basic default, and didn’t worry too much about it.
One thing that always bugged me a little bit was how the instruction
names weren’t exactly the same. AT&T made you put these suffixes on
your instructions, so mov
would become movl
. The main problem
with this is Googleability.
But today what was previously an annoyance reached the level of being
a serious problem. I was looking at an AT&T disassembly and saw the
instruction movslq
. First I Googled for movsl (presuming that the
“q” was a “quadword” suffix), but that yielded nothing. Then I tried
Googling for movslq
in its entirety, still nothing that seemed to
define the instruction.
What I finally discovered is that movslq
in AT&T syntax corresponds
to movsxd
in Intel syntax. I don’t know how or why, but you can no
longer count on the instruction names being the same between AT&T and
Intel (modulo size prefixes). The moment I discovered this, it became
quite clear to me that AT&T syntax was a dead end. If the instruction
names can differ this much, it only makes sense to use the scheme that
all the processor manuals themselves use (not to mention every
toolchain besides the GNU one). “-M intel” will be my default
parameter to objdump from now on.