Page 1 of 1
What is offset instruction in AT&T syntax?
Posted: Sun Apr 17, 2022 12:47 am
by NeonLightions
Hi,
Like the title, I want to know which instruction in AT&T syntax as same as "offset" instruction in Intel syntax?
Re: What is offset instruction in AT&T syntax?
Posted: Sun Apr 17, 2022 1:02 am
by kzinti
I think you are looking for the $ prefix... "offset" is not an instruction but a statement that tells the assembler you want the address (really the segment offset) of the following expression.
For example:
Code: Select all
mov offset label, eax # Get the address of label into eax
Becomes:
Code: Select all
movl %eax, $label # Get the address of label into eax
I am not sure if this covers all the cases. But t might just do.
Re: What is offset instruction in AT&T syntax?
Posted: Sun Apr 17, 2022 5:24 am
by BigBuda
kzinti wrote:I think you are looking for the $ prefix... "offset" is not an instruction but a statement that tells the assembler you want the address (really the segment offset) of the following expression.
For example:
Code: Select all
mov offset label, eax # Get the address of label into eax
Becomes:
Code: Select all
movl %eax, $label # Get the address of label into eax
I am not sure if this covers all the cases. But t might just do.
Didn't you mistake the order? Isn't the exact opposite? Intel syntax is mov destination, source and AT&T is mov source, destination.
Re: What is offset instruction in AT&T syntax?
Posted: Sun Apr 17, 2022 9:12 am
by NeonLightions
Oh, so it just basically the "$" prefix? Thank you for the answer!
Re: What is offset instruction in AT&T syntax?
Posted: Sun Apr 17, 2022 10:44 am
by kzinti
BigBuda wrote:Didn't you mistake the order? Isn't the exact opposite? Intel syntax is mov destination, source and AT&T is mov source, destination.
Yep, sure did. Just inverse the operands in both of my examples.