Why does my disassembled C++ code use the instruction pointer and an offset to get string literals?

Viewed 401

I have a C++ program of mine that I've disassembled, and it seems like the assembly is using the instruction pointer to get at string literals. For example:

leaq    0x15468(%rip), %rsi ## literal pool for: "special"

and

leaq    0x15457(%rip), %rsi ## literal pool for: "ordinary"

Why does the compiler use the instruction pointer to get at string literals? This seems like it would result in a substantial headache for any human programmer, although it's probably not as hard for the compiler.

My question, though, is why? Is there some machine based or historical reason or did the compiler writers just decide to use %rip arbitrarily?

1 Answers
Related