For x86-win32 we got __ImageBase,
Is there any simple way to create a GlobalVariable pointing to the image base on all platforms?
What is an image base?
Joerg
Image base is the PE/COFF base address (the relocated one) - pointer to header.
In ELF the PIC calculations use PC + offset to GOT, so the image base would be actually PC minus assumed PC offset, or GOT minus assumed GOT offset (offset taken from the ELF header)
I guess that could be easy calculated using MachineInstruction. Just thinking if something can be done using IR and GlobalVariables…
I don’t think there’s an easy way for all platforms. Try __executable_start for ELF, though.