<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><span style="font-family:Arial,Helvetica,sans-serif">I'm trying to do something with a global variable value with IRBuilder in LLVM pass. I refer to a specific global variable contained in a source file. </span><br></div><div dir="ltr"><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif"><div style="margin:0px;padding:0px;border:0px"><font face="courier new, monospace" style="margin:0px;padding:0px;border:0px"> GlobalVariable *VarTest =</font></div><div style="margin:0px;padding:0px;border:0px"><font face="courier new, monospace" style="margin:0px;padding:0px;border:0px"> new GlobalVariable(M, PointerType::get(Int32Ty, 0), false,</font></div><div style="margin:0px;padding:0px;border:0px"><font face="courier new, monospace" style="margin:0px;padding:0px;border:0px"> GlobalValue::ExternalLinkage, 0, "vartest");</font></div></div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif">Then, I pass that variable to a runtime function with CreateCall.</div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif">However, I can't seem to access any variables from the source code. I get "undefined reference to 'vartest.5'" when attempting the pass. Why is it adding a '.5' to my variable name? </div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif"><br></div><div style="text-decoration-style:initial;text-decoration-color:initial;margin:0px;padding:0px;border:0px;font-family:Arial,Helvetica,sans-serif">How do I access a global variable from the target source?</div>
<br></div>
</div></div>