Niddodi, Chaitra via llvm-dev
2021-Jun-08 02:37 UTC
[llvm-dev] Specify address of extern variable in llvm bitcode
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210608/69e1b0a1/attachment-0001.html>
David Blaikie via llvm-dev
2021-Jun-08 05:36 UTC
[llvm-dev] Specify address of extern variable in llvm bitcode
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>