[llvm-dev] GlobalVariable to image base

BBLN via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 3 08:45:57 PDT 2016


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..

2016-09-03 18:21 GMT+03:00 Joerg Sonnenberger via llvm-dev <
llvm-dev at lists.llvm.org>:

> On Sat, Sep 03, 2016 at 05:05:32PM +0300, BBLN via llvm-dev wrote:
> > 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160903/667daf1c/attachment.html>


More information about the llvm-dev mailing list