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?

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.