I'm mastering my assembly, using Raspberry Pi 3 and confused with endianness of the values in literal pool.
As showed, my system is little-endian:
~ $ lscpu
Architecture: armv7l
Byte Order: Little Endian
...
Here is part of my code:
hostaddr:
.hword 2
.hword 0x115c //4444
.word 0
After comilation objdump showes me:
000100a8 <hostaddr>:
100a8: 115c0002 .word 0x115c0002
100ac: 00000000 .word 0x00000000
That seems ok, but during execution with strace it smashes the value:
bind(3, {sa_family=AF_INET, // 0x02
sin_port=htons(23569), // 0x5c11
sin_addr=inet_addr("0.0.0.0")}, 16)
Does it mean that I should respect endianness leaving value in literal pool? Why 0x0002(AF_INET) was not swapped in that case?
Thanks!
User contributions licensed under CC BY-SA 3.0