On 02/01/13 14:33, Alexander Graf wrote:
Can't we manually relocate our OpenBIOS code when relocating it?
Imagine we add an extra extraction step to the build process before omitting the final .elf file. In that step we copy the elf relocation info into a special data section that is accessible from within OpenBIOS.
Now when we relocate our .text section down to offset 0x0 we also run a normal elf relocator to move all .data variable access down to offset 0x0.
That way we could still keep globals around, right?
Possibly, yes. I've been reading around how relocation works with ELF, and I've found something we could potentially use here:
http://www.math.utah.edu/docs/info/ld_3.html#SEC18
See the part about the AT keyword and the corresponding C code. Could this be used to relocate the image to a fixed location in RAM without having to create a full-blown ELF relocator?
Otherwise I guess we have to have multiple .text sections; one containing an ELF relocator and another containing the payload itself. I'm not sure whether that would affect non-QEMU use of OpenBIOS though.
ATB,
Mark.