I'm using g++ with the -S option, and I'm getting lots of operators I don't know or understand, and google is not leading me to a result. Some examples are fldt
, fstpl
, and I don't come across a quick reference to what it does. It seems odd that I can't find documentation for it, is there a place for me to look that is more complete than trying to google assembly operators? What are some good resources?
-
1The are instructiins, not operators. And yes, every single one of them will be explained in the manufacturer's documentation. I'm assuming x86 so download Intel's assembly documentation, or one of the many other instruction lists. Just note that some commands have several forms and may have letters added to them, like fld – Sami Kuhmonen May 22 '17 at 03:56
-
2http://www.felixcloutier.com/x86/ has an instruction set reference based on the Intel manuals. ATT syntax uses instruction mnemonics that may end with an additional `l`, `t`, `w` `b` `q` for the size. In your case you want to look at the instructions FLD and FSTP. – Michael Petch May 22 '17 at 03:56
-
I usually refer to this one: x86.renejeschke.de – Pyves May 22 '17 at 07:06
-
You can get _GCC_ to dump the `-S` output as Intel syntax by adding the `-masm=intel` option. – Michael Petch May 22 '17 at 12:09
2 Answers
Reading the reference manual may be the best investment. What you could also do is produce Intel syntax (see here)
> gcc -g -c test.c
> objdump -d -M intel -S test.o > test.asm
The resulting test.asm file is not an assembly file that can be assembled by an assembler but can be useful in studying your program. And assuming you have access to Visual Studio, you can open test.asm with Visual Studio and install the extension AsmDude to get quick feedback on what the instructions do.
-
No, gcc's intel syntax output can of course also be assembled with the GNU assembler. – fuz May 22 '17 at 12:15
-
@fuz could you clarify the no. My sentence just states that the resulting test.asm may offend your assembler a bit. – HJLebbink May 22 '17 at 12:37
-
It doesn't actually “offend” the assembler. The GNU assembler can be switched between AT&T and Intel mode. – fuz May 22 '17 at 13:37
-
@fuz I mean objdump does not generate a "true" asm file, never mind. – HJLebbink May 22 '17 at 14:56
-
Oh sorry, I totally misread your question. I somehow read that you want to pass `-masm=intel` to gcc. Objection withdrawn. – fuz May 22 '17 at 15:17
The canonical reference for all of this is the Intel® 64 and IA-32 Architectures Software Developer’s Manual. You can find it on the Intel website. I am not going to provide a link as they frequently shift around their page structure.
Note that this manual is comprehensive and very detailed, for a beginner it might be a bit overwhelming. Read this manual carefully, many instructions have fairly subtle behaviour.
Lastly, note that g++
emits assembly in AT&T-syntax. Among other things, this means that most instructions with more than one operand have their operands flipped, for example, the instruction add %ax,%bx
adds ax
to bx
and stores the result in bx
.

- 88,405
- 25
- 200
- 352