[llvm-dev] Specify address of extern variable in llvm bitcode

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 7 22:36:09 PDT 2021


Don't think so. But you could skip using a variable entirely if you know
it's at a constant address, instead of needing a symbol lookup.

You could skip it by taking the pointer constant as an integer constant and
int2ptr casting it to a pointer, then loading from that - not using a
global variable (decl or def) instead.

But probably using a symbol is better/more flexible.

On Mon, Jun 7, 2021 at 7:37 PM Niddodi, Chaitra via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> How to specify address of an extern variable in llvm bitcode?
>
> Say, I have an int variable declared as
>
> extern int key;
>
> and the address of the variable is 0x7f4c2dacf000
>
> Is there a way to modify the llvm bitcode to specify the variable's
> address?
>
> Thanks,
> Chaitra
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://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/20210607/bca0b8cd/attachment.html>


More information about the llvm-dev mailing list