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

前端 未结 2 899
时光说笑
时光说笑 2020-11-27 19:05

How do I use RIP Relative Addressing in a Linux assembly program for the AMD64 archtitecture? I am looking for a simple example (a Hello world program) that uses the AMD64 R

2条回答
  •  隐瞒了意图╮
    2020-11-27 19:26

    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.

提交回复
热议问题