I don't understand why the output of the code is Ole. Shouldn't little endianness affect the push command?
global _start
section .data
x: dd 3
section .text
_start:
mov eax, 4
mov ebx, 1
mov dword[x], 0x0a656c4f
push dword[x]
mov ecx, esp
mov edx, 4
int 0x80
mov eax,1
mov ebx, 0
int 0x80
If I got it right after mov dword[x], 0x0a656c4f the memory layout is :
0a (higher)
65
6c
4f (lower)
because of little endianness of x86 and x points to byte whose value is 4f. After push dword[x], there's the same picture of stack (reversed as it grows downwards) where esp points to 0a
The same question is relevant to the code when
mov dword[x], 0x0a656c4f
push dword[x]
is replaced with:
push dword 0x0a656c4f
Thanks.