<div dir="ltr">An enumeration for the kinds of linkage for global values.<br><br>Hi, I'm currently writing a compiler that takes llvm-ir input. I'm a little confused by the following linkage flags:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Enumerator: <br><br>ExternalLinkage: Externally visible function<br><br>AvailableExternallyLinkage: Available for inspection, not emission.<br><br>LinkOnceAnyLinkage: Keep one copy of function when linking (inline)<br><br>LinkOnceODRLinkage: Same, but only replaced by something equivalent.<br><br>WeakAnyLinkage: Keep one copy of named function when linking (weak)<br><br>WeakODRLinkage: Same, but only replaced by something equivalent.<br><br>AppendingLinkage: Special purpose, only applies to global arrays.<br><br>InternalLinkage: Rename collisions when linking (static functions).<br><br>PrivateLinkage: Like Internal, but omit from symbol table.<br><br>ExternalWeakLinkage: ExternalWeak linkage description.<br><br>CommonLinkage: Tentative definitions.<br></blockquote><br>When I have source code like:<div><br></div><div>int x = 0;</div><div>int main(){...}</div><div><br></div><div>I end up with an ExternalLinkage flag on x. Why would this not have CommonLinkage? When I have the same code as above and don't initialize x,</div><div>I end up with the CommonLinkage flag.</div><div><br></div><div>Any insight would be appreciated.</div><div><br></div><div>Best,</div><div>M.R.</div></div>