[LLVMdev] LLVM linkage flags

Max Ruttenberg mruttenberg at emutechnology.com
Fri Jul 24 10:24:49 PDT 2015


An enumeration for the kinds of linkage for global values.

Hi, I'm currently writing a compiler that takes llvm-ir input. I'm a little
confused by the following linkage flags:

Enumerator:
>
> ExternalLinkage: Externally visible function
>
> AvailableExternallyLinkage: Available for inspection, not emission.
>
> LinkOnceAnyLinkage: Keep one copy of function when linking (inline)
>
> LinkOnceODRLinkage: Same, but only replaced by something equivalent.
>
> WeakAnyLinkage: Keep one copy of named function when linking (weak)
>
> WeakODRLinkage: Same, but only replaced by something equivalent.
>
> AppendingLinkage: Special purpose, only applies to global arrays.
>
> InternalLinkage: Rename collisions when linking (static functions).
>
> PrivateLinkage: Like Internal, but omit from symbol table.
>
> ExternalWeakLinkage: ExternalWeak linkage description.
>
> CommonLinkage: Tentative definitions.
>

When I have source code like:

int x = 0;
int main(){...}

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,
I end up with the CommonLinkage flag.

Any insight would be appreciated.

Best,
M.R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150724/bd353f1d/attachment.html>


More information about the llvm-dev mailing list