I've written (more like copied) the following assembly code :
section .text
global main
main:
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov eax,1
int 0x80
section .data
msg db 'Hello, world!', 0xa
len equ $ - msg
I've compiled it with NASM using the following command: nasm -g -f elf test.asm
and then gcc test.o -o testasm
then I used GDB to debug testasm, and issued the command "disassemble main", which gave the following return:
0x080483c0 <+0>: mov $0xe,%edx
0x080483c5 <+5>: mov $0x804a010,%ecx
0x080483ca <+10>: mov $0x1,%ebx
0x080483cf <+15>: mov $0x4,%eax
0x080483d4 <+20>: int $0x80
0x080483d6 <+22>: mov $0x1,%eax
0x080483db <+27>: int $0x80
0x080483dd <+29>: nop
0x080483de <+30>: nop
0x080483df <+31>: nop
Which is not quite the same. I undertand that in machine binary code there's no declaration of constants, but where in this disassembled code is the "Hello, world!" string? I tried to convert $0x804a010 to string but that's not it, so I don't know.
Any clues?