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?
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?
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.
.intel_syntax noprefix
is not AT&T syntax at all. The GNU assembler's default .att_syntax
is compatible with the syntax AT&T used for their x86 Unix assembler, but .intel_syntax noprefix
was a more recent addition to GAS that doesn't derive from anything AT&T designed. –
Pyles © 2022 - 2024 — McMap. All rights reserved.
OFFSET
keyword, but you tagged it NASM, so which do want to know? – Goatish