- <a href="#i_call">call</a> int %puts(sbyte* %cast210) <i>; int</i>
- <a href="#i_ret">ret</a> int 0
-}
-</pre>
-
-This example is made up of a <a href="#globalvars">global variable</a> named
-"<tt>.LC0</tt>", an external declaration of the "<tt>puts</tt>" function, and a
-<a href="#functionstructure">function definition</a> for "<tt>main</tt>".<p>
-
-<a name="linkage_decl">
-In general, a module is made up of a list of global values, where both functions
-and global variables are global values. Global values are represented by a
-pointer to a memory location (in this case, a pointer to an array of char, and a
-pointer to a function), and can be either "internal" or externally accessible
-(which corresponds to the static keyword in C, when used at global scope).<p>
-
-For example, since the "<tt>.LC0</tt>" variable is defined to be internal, if
-another module defined a "<tt>.LC0</tt>" variable and was linked with this one,
-one of the two would be renamed, preventing a collision. Since "<tt>main</tt>"
-and "<tt>puts</tt>" are external (i.e., lacking "<tt>internal</tt>"
-declarations), they are accessible outside of the current module. It is illegal
-for a function declaration to be "<tt>internal</tt>".<p>
-
-
+ <a
+ href="#i_call">call</a> int %puts(sbyte* %cast210) <i>; int</i>
+ <a
+ href="#i_ret">ret</a> int 0<br>}<br></pre>
+<p>This example is made up of a <a href="#globalvars">global variable</a>
+named "<tt>.LC0</tt>", an external declaration of the "<tt>puts</tt>"
+function, and a <a href="#functionstructure">function definition</a>
+for "<tt>main</tt>".</p>
+<a name="linkage"> In general, a module is made up of a list of global
+values, where both functions and global variables are global values.
+Global values are represented by a pointer to a memory location (in
+this case, a pointer to an array of char, and a pointer to a function),
+and have one of the following linkage types:</a>
+<p> </p>
+<dl>
+ <a name="linkage_internal"> <dt><tt><b>internal</b></tt> </dt>
+ <dd>Global values with internal linkage are only directly accessible
+by objects in the current module. In particular, linking code into a
+module with an internal global value may cause the internal to be
+renamed as necessary to avoid collisions. Because the symbol is
+internal to the module, all references can be updated. This
+corresponds to the notion of the '<tt>static</tt>' keyword in C, or the
+idea of "anonymous namespaces" in C++.
+ <p> </p>
+ </dd>
+ </a><a name="linkage_linkonce"> <dt><tt><b>linkonce</b></tt>: </dt>
+ <dd>"<tt>linkonce</tt>" linkage is similar to <tt>internal</tt>
+linkage, with the twist that linking together two modules defining the
+same <tt>linkonce</tt> globals will cause one of the globals to be
+discarded. This is typically used to implement inline functions.
+Unreferenced <tt>linkonce</tt> globals are allowed to be discarded.
+ <p> </p>
+ </dd>
+ </a><a name="linkage_weak"> <dt><tt><b>weak</b></tt>: </dt>
+ <dd>"<tt>weak</tt>" linkage is exactly the same as <tt>linkonce</tt>
+linkage, except that unreferenced <tt>weak</tt> globals may not be
+discarded. This is used to implement constructs in C such as "<tt>int
+X;</tt>" at global scope.
+ <p> </p>
+ </dd>
+ </a><a name="linkage_appending"> <dt><tt><b>appending</b></tt>: </dt>
+ <dd>"<tt>appending</tt>" linkage may only be applied to global
+variables of pointer to array type. When two global variables with
+appending linkage are linked together, the two global arrays are
+appended together. This is the LLVM, typesafe, equivalent of having
+the system linker append together "sections" with identical names when
+.o files are linked.
+ <p> </p>
+ </dd>
+ </a><a name="linkage_external"> <dt><tt><b>externally visible</b></tt>:</dt>
+ <dd>If none of the above identifiers are used, the global is
+externally visible, meaning that it participates in linkage and can be
+used to resolve external symbol references.
+ <p> </p>
+ </dd>
+ </a>
+</dl>
+<p> </p>
+<p><a name="linkage_external">For example, since the "<tt>.LC0</tt>"
+variable is defined to be internal, if another module defined a "<tt>.LC0</tt>"
+variable and was linked with this one, one of the two would be renamed,
+preventing a collision. Since "<tt>main</tt>" and "<tt>puts</tt>" are
+external (i.e., lacking any linkage declarations), they are accessible
+outside of the current module. It is illegal for a function <i>declaration</i>
+to have any linkage type other than "externally visible".</a></p>
+</div>