So I was playing around with some assembly today and I noticed when compiling the following code using as -o foo.o foo.s
I get a different result than I would expect:
.section .text
.globl _start
.intel_syntax noprefix
_start:
mov rsi, rsp
mov rdx, 0x1234567890ABCDEF
mov qword [rsi], rdx
.. which compiles to:
# objdump -D -M intel foo.o
oo.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <_start>:
0: 48 89 e6 mov rsi,rsp
3: 48 ba ef cd ab 90 78 movabs rdx,0x1234567890abcdef
a: 56 34 12
d: 48 89 56 08 mov QWORD PTR [rsi+0x8],rdx
I was wondering why as
adds another 0x8 to the memory write (qword [rsi]
vs. QWORD PTR [rsi+0x8]
)??!