Weigel Gram
Weigel Gram

Reputation: 183

Intel assembly syntax OFFSET

Now that i know u can use gcc for Intel syntax instead of default at&t with

gcc -S -masm=intel test.c

There is this line

mov DWORD PTR [ebp-16], OFFSET FLAT:base

Is it the same as mov dword[ebp-16], base? Otherwise what must i do?

Upvotes: 6

Views: 6140

Answers (1)

Frank Kotler
Frank Kotler

Reputation: 1452

Yes, mov dword [ebp - 16], base is correct NASM syntax to store the label address to 4 bytes of memory at EBP-16.

I haven't seen offset flat: for a while - I think it's obsolete, but it's what GAS's idea of .intel_syntax noprefix used to demand (I had to look at Gas's source code to find that out). gcc -masm=intel uses it when using symbol addresses as immediates, but offset base works, too, in GAS.

It means the same as offset to MASM, or the unadorned variable name in NASM.

Upvotes: 8

Related Questions