On 8/3/20 3:27 AM, David Laight wrote:
From: Mark Rutland
quoted
Sent: 31 July 2020 19:32
...
quoted
quoted
It requires PC-relative data references. I have not worked on all architectures.
So, I need to study this. But do all ISAs support PC-relative data references?
Not all do, but pretty much any recent ISA will as it's a practical
necessity for fast position-independent code.
i386 has neither PC-relative addressing nor moves from %pc.
The cpu architecture knows that the sequence:
call 1f
1: pop %reg
is used to get the %pc value so is treated specially so that
it doesn't 'trash' the return stack.
So PIC code isn't too bad, but you have to use the correct
sequence.
Is that true only for 32-bit systems only? I thought RIP-relative addressing was
introduced in 64-bit mode. Please confirm.
Madhavan