Problem with GAS assembler and LD linker
Posted: Tue Aug 18, 2009 4:44 pm
Hi,
I wrote some line of code in asm in NASM:
mov bx,ax
I converted to binary code using: nasm -o test.bin test.s
using ndisasm test.bin, the resulting binary code is: 89C3, it says in ndisasm mov bx ax
(00000000 89C3 mov bx,ax)
and I wrote the exact line of code in GAS syntax:
movw %ax,%bx
I converted to binary code using: gas -o test2.o test2.s && ld --oformat binary -s -o test2.bin test2.s
using ndisasm test2.bin, the resulting binary code is 6689C3 (that is bad), it says in ndisasm mov ebx eax
(00000000 6689C3 mov ebx,eax)
What's happening?? Why GAS and LD are making bad machine code?
Please, I need help...
I wrote some line of code in asm in NASM:
mov bx,ax
I converted to binary code using: nasm -o test.bin test.s
using ndisasm test.bin, the resulting binary code is: 89C3, it says in ndisasm mov bx ax
(00000000 89C3 mov bx,ax)
and I wrote the exact line of code in GAS syntax:
movw %ax,%bx
I converted to binary code using: gas -o test2.o test2.s && ld --oformat binary -s -o test2.bin test2.s
using ndisasm test2.bin, the resulting binary code is 6689C3 (that is bad), it says in ndisasm mov ebx eax
(00000000 6689C3 mov ebx,eax)
What's happening?? Why GAS and LD are making bad machine code?
Please, I need help...