How to use RIP Relative Addressing in a 64-bit assembly program?

I believe that you want to load the address of your string into %rsi; your code attempts to load a quadword from that address rather than the address itself. You want:

lea msg(%rip), %rsi

if I’m not mistaken. I don’t have a linux box to test on, however.

Leave a Comment