Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limitations of Intel Assembly Syntax Compared to AT&T [closed]

To me, Intel syntax is much easier to read. If I go traipsing through assembly forest concentrating only on Intel syntax, will I miss anything? Is there any reason I would want to switch to AT&T (outside of being able to read others' AT&T assembly)? My first clue is that gdb uses AT&T by default.

If this matters, my focus is only on any relation assembly and syntax may have to Linux/BSD and the C language.

like image 659
oevna Avatar asked Jun 09 '09 21:06

oevna


People also ask

Does Linux use AT& t syntax?

The primary syntax for the GNU assembler (GAS) is AT&T. Intel syntax is a relatively new addition to it. x86 assembly in the Linux kernel is in AT&T syntax.

Why does AT&T syntax exist?

GNU adopted AT&T syntax, that made it common on Unix. And Windows, lots of programmers use GNU tooling there as well. Easier for the compiler, not humans, it can tell which registers get trashed and the syntax scales easier across architectures. With a dash of Motorola semantics, common on old Unixes.

What does MOVB do in assembly?

MOVB and MOVW are data movement instructions which more closely resemble the MOVE instructions of CPU32-based microcontrollers more so than the load-store architecture of the 8- and 16-bit machines. The PSHM and PULM instructions move data to and from the registers and the built-in hardware stack.


2 Answers

There is really no advantage to one over the other. I agree though that Intel syntax is much easier to read. Keep in mind that, AFAIK, all GNU tools have the option to use Intel syntax also.

It looks like you can make GDB use Intel syntax with this:

 set disassembly-flavor intel 

GCC can do Intel syntax with -masm=intel.

like image 140
Zifre Avatar answered Sep 19 '22 11:09

Zifre


The primary syntax for the GNU assembler (GAS) is AT&T. Intel syntax is a relatively new addition to it. x86 assembly in the Linux kernel is in AT&T syntax. In the Linux world, it's the common syntax. In the MS world, Intel syntax is more common.

Personally, I hate AT&T syntax. There are plenty of free assemblers (NASM, YASM) along with GAS that support Intel syntax too, so there won't be any problems doing Intel syntax in Linux.

Beyond that, it's just a syntactic difference. The result of both will be the same x86 machine code.

like image 25
mmx Avatar answered Sep 22 '22 11:09

mmx