Hi and sorry about butting in out of nowhere.
I have a question about absolute addressing on ARMv6 processors as used in the Raspi. Recently I have written a back end for said processor and wondered about the best method for loading a value from an absolute address into a register when the absolute address cannot be known at compile time (i.e. cannot be placed in range for PC-relative addressing).
I came up with the following code to load a value from X:
.data X: .long 0 /* arbitrary distance here */ .data L1: .long X .text ldr r0,L1 ldr r0,[r0]
which works fine.
Now someone told me that it might be possible to construct absolute addresses with MOV/MOVT and let the linker fix the gory stuff.
I doubt that because of the limitations the ARM seems to place on immediate values in MOV and MOVT. If I understand the manual correctly, immediate operands of MOV and friends must be 8-bit values that can be shifted to the left by up to eight bits.
Wouldn't this limitation make MOV/MOVT unsuitable for loading absolute addresses that cannot be known at compile time?
Or am I missing something? Any hints would be welcome!