Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NASM to GAS syntax using intel2gas

I have a code written in NASM syntax and is working well. I then used intel2gas to convert my NASM code into GAS. (used -i , the default which is intel to at&t format).

I never used GAS before, just pure NASM in all my assembly needs. I used intel2gas to learn the GAS code format. Now, I have some line in the converted GAS code which have warnings from intel2gas and was appended with a 'MISMATCH: ' prefix.

I have managed the others like in the .data and .bss sections, but I still have these:

MISMATCH: "lea ecx, [array + esi]"
MISMATCH: "lea ebx, [array + esi + 1]"
MISMATCH: "mov al, [array + esi]"
MISMATCH: "mov cl, [array + esi + 1]"

What's the equivalent GAS syntax of the NASM lines above?

Why did intel2gas did not completely convert my code and had left several MISMATCH lines?

Please help, thanks!


Using Ubuntu 13 x86

like image 725
Kevin Lloyd Bernal Avatar asked Dec 02 '25 04:12

Kevin Lloyd Bernal


1 Answers

lea ecx, [array + esi]
lea ebx, [array + esi + 1]
mov al, [array + esi]
mov cl, [array + esi + 1]

All these lines don't use constant offset from address stored in register. From the view of syntax translator, label addresses aren't known and it can't be sure what configuration does target compiler use.

Translation:

lea array(%esi), %ecx
lea array+1(%esi), %ebx
movb array(%esi), %al
movb array+1(%esi), %cl
like image 120
user35443 Avatar answered Dec 04 '25 18:12

user35443



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!