[LLVMdev] External constants and RIP relative addressing

Chris Lattner
Mon, 16 May 2011 15:46:10 -0000

On May 16, 2011, at 6:24 AM, Chris Stavrakakis wrote:

> Hi all,
>
> in llvm-2.8, i declare an external constant of i64 and i want the
> instructions that use the value of this constant to use absolute
> addressing instead of RIP relative, that is:
>
> I get: "48 8b 35 00 00 00 00     mov    0x0(%rip),%rsi"
#AT&T syntax
> But i would prefer: "48 BE 00 00 00 00 00 00      mov     0x0,
%rsi"
>
> The reason i want this is that i use a specific loader that expects
> absolute addressing for patching constants.
>
> Is there any way to achieve this?

Hi Chris,

You'll have to hack up the code generator, there is no user visible knob to
turn off rip relative addressing.

-Chris