2

I'd like to use the instruction lea rax, [rip + 0x1020304] with NASM but it seems like it doesn't allow that use of rip.

GAS (GNU Assembler) does allow this syntax for both numbers and symbols (How do RIP-relative variable references like "[RIP + _a]" in x86-64 GAS Intel-syntax work?). How can I achieve this with NASM?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
phip1611
  • 5,460
  • 4
  • 30
  • 57
  • 5
    nasm uses the `rel` keyword but apparently you can't apply that to numerical absolute address. Normally it would look like `lea rax, [rel foo]`. If you really must, you can use a workaround along the lines of `lea rax, [rel $+0x1020304+7]` – Jester Jul 21 '21 at 13:15

0 Answers0