diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -272,8 +272,8 @@ visible, meaning that it participates in linkage and can be used to resolve external symbol references. -It is illegal for a function *declaration* to have any linkage type -other than ``external`` or ``extern_weak``. +It is illegal for a global variable or function *declaration* to have any +linkage type other than ``external`` or ``extern_weak``. .. _callingconv: @@ -615,6 +615,8 @@ Global variables in other translation units can also be declared, in which case they don't have an initializer. +Global variables can optionally specify a :ref:`linkage type `. + Either global variable definitions or declarations may have an explicit section to be placed in and may have an optional explicit alignment specified. If there is a mismatch between the explicit or inferred section information for the @@ -686,6 +688,13 @@ iterate over them as an array, alignment padding would break this iteration. The maximum alignment is ``1 << 29``. +For global variables declarations, as well as definitions that may be +replaced at link time (``linkonce``, ``weak``, ``extern_weak`` and ``common`` +linkage types), LLVM makes no assumptions about the allocation size of the +variables, except that they may not overlap. The alignment of a global variable +declaration or replaceable definition must not be greater than the alignment of +the definition it resolves to. + Globals can also have a :ref:`DLL storage class `, an optional :ref:`runtime preemption specifier `, an optional :ref:`global attributes ` and