An easy way to answer this is to assemble the instruction into an object file and disassemble it in Intel syntax. You might use a command something like objdump -d -Mintel test.o
.
Doing it that way gives us:
Disassembly of section .text:
0000000000000000 <test>:
0: 48 8d 3d 00 00 00 00 lea rdi,[rip+0x0] # 7 <test+0x7>
And that should be pretty clear. Note that mystring
has turned into 0x0
: those zeros are placeholder bytes which will be adjusted at link time using the relocation of mystring
. In your assembly source, you would use an identifier there.
Edit: to make it more clear, here is an example source file:
.intel_syntax noprefix
.globl test
test:
lea rdi, [rip+mystring]
And here is the disassembly (from objdump -rd -Mintel test.o
). Note the PC-relative relocation:
0000000000000000 <test>:
0: 48 8d 3d 00 00 00 00 lea rdi,[rip+0x0] # 7 <test+0x7>
3: R_X86_64_PC32 mystring+0xfffffffffffffffc