Subtracting registers with an LEA instruction?
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm